Search Results

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

Search depends on additional output content type of JSON in config.toml

1
2
[outputs]
  home = ["HTML", "JSON"]

To search additional fields defined in front matter, you must add it in 2 places.

This exposes the values in /index.json i.e. add category

1
2
3
4
5
6
...
  "contents":{{ .Content | plainify | jsonify }}
  {{ if .Params.tags }},
  "tags":{{ .Params.tags | jsonify }}{{end}},
  "categories" : {{ .Params.categories | jsonify }},
...

static/js/search.js

1
2
3
4
5
6
keys: [
  "title",
  "contents",
  "tags",
  "categories"
]