
Amend Hugo Theme Even
By default, the theme even doesn’t support the search and copy to the clipboard button which is proposed in issues#289 and issues#399. So I have finished implementing the features. 1. Search Initially, you should add the output of JSON in your ./config.toml file. 1 2 [outputs] home = ["HTML", "RSS", "JSON"] Then create the file ./themes/even/layouts/_default/index.json and add these lines. Then make sure you can see the output in the localhost:1313/index.json. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 {{- $.Scratch.Add "index" slice -}} {{- range $index, $element := .Site.RegularPages.ByTitle -}} {{if ne .Params.tags nil}}{{if ne .Plain nil}} {{- $.Scratch.Add "index" (dict "id" $index "date" .Date "tags" .Params.tags "categories" .Params.categories "title" .Title "permalink" .Permalink "contents" .Plain ) -}} {{end}}{{end}} {{- end -}} {{- $.Scratch.Get "index" | jsonify -}} And add file ./themes/even/static/js/search.js. I have stored the search object so just need to load the file one time once you enter the search page. ...