[Logo for The C Shore Landing Page]
The C Shore

Search Setup

Information on configuration search

Table of Contents

Search Setup

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", "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"
]