Make search multilingual (#305)
* Make search multilingual * Added Support for custom country flags * Add search.md for more language + fix search behavior Signed-off-by: hossainemruz <hossainemruz@gmail.com> Co-authored-by: Pablo Marcos <codebergflamingo@staplehorse.anonaddy.com> Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
This commit is contained in:
parent
16f64aa4c2
commit
ac28e9824e
34 changed files with 1315 additions and 17 deletions
54
content/posts/search.ru.md
Normal file
54
content/posts/search.ru.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
title: "Search Results"
|
||||
date: 2010-06-08T08:06:25+06:00
|
||||
weight: 999999
|
||||
sitemap:
|
||||
priority : 0.1
|
||||
layout: "search"
|
||||
url: search
|
||||
---
|
||||
|
||||
|
||||
This file exists solely to respond to /search URL with the related `search` layout template.
|
||||
|
||||
No content shown here is rendered, all content is based in the template layouts/page/search.html
|
||||
|
||||
Setting a very low sitemap priority will tell search engines this is not important content.
|
||||
|
||||
This implementation uses Fusejs, jquery and mark.js
|
||||
|
||||
|
||||
## Initial setup
|
||||
|
||||
Search depends on additional output content type of JSON in config.toml
|
||||
\```
|
||||
[outputs]
|
||||
home = ["HTML", "JSON"]
|
||||
\```
|
||||
|
||||
## Searching additional fileds
|
||||
|
||||
To search additional fields defined in front matter, you must add it in 2 places.
|
||||
|
||||
### Edit layouts/_default/index.JSON
|
||||
This exposes the values in /index.json
|
||||
i.e. add `category`
|
||||
\```
|
||||
...
|
||||
"contents":{{ .Content | plainify | jsonify }}
|
||||
{{ if .Params.tags }},
|
||||
"tags":{{ .Params.tags | jsonify }}{{end}},
|
||||
"categories" : {{ .Params.categories | jsonify }},
|
||||
...
|
||||
\```
|
||||
|
||||
### Edit fuse.js options to Search
|
||||
`static/js/search.js`
|
||||
\```
|
||||
keys: [
|
||||
"title",
|
||||
"contents",
|
||||
"tags",
|
||||
"categories"
|
||||
]
|
||||
\```
|
Loading…
Add table
Add a link
Reference in a new issue