diff --git a/content/notes/search.md b/content/notes/search.md new file mode 100644 index 0000000..0f038c1 --- /dev/null +++ b/content/notes/search.md @@ -0,0 +1,52 @@ +--- +title: "Search Results" +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" +] +\``` diff --git a/i18n/en.toml b/i18n/en.toml index 21d1335..18ddf66 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -106,3 +106,7 @@ other = "More" [view_certificate] other = "View Certificate" + +# ============== Translations for Notes ============== +[notes] +other = "Notes" diff --git a/layouts/_default/list.html b/layouts/_default/list.html index ae014d1..ac93f3c 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -23,7 +23,7 @@