[Logo for Hugo OldNew Mashup Theme Homepage]
OldNew Mashup

Search Setup

Information on configuration of search

Table of Contents

This implementation uses Fusejs, and mark.js (without jQuery)

Initial setup

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

[outputs]
  home = ["HTML", "RSS", "JSON"]

Searching additional fields

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}}
  {{ if .Params.categories }},
  "categories" : {{ .Params.categories | jsonify }}{{ end }}
...

static/js/search.js

keys: [
  "title",
  "contents",
  "tags",
  "categories"
]

See Also