Hi,
I have added a search bar for one of my section , Blogs. For that I am using this approach Janik Vonrotz - Simple Hugo page search with Lunr.js
I have added index.json file in my layouts folder.
It looks like this
[{{ range $index, $page := .Site.RegularPages }}
{{ if eq .Section "blogs" }}
{{- if ne $page.Type "json" -}}
{{- if and $index (gt $index 0) -}},{{- end }}
{
"uri": "{{ $page.Permalink }}",
"title": "{{ htmlEscape $page.Title}}",
"content": {{$page.Plain | jsonify}}
}
{{- end -}}
{{- end -}}
{{- end -}}]
Now above is working fine , index.json file gets created in dist folder and search is working fine.
Now my next requirement is I want separate search but for a different section, Resource, so Blog’s search should search only in blogs and resource’s search in only resources folder.
For this I created another search.json file and placed it in layouts folder again with same as above code and only one line of code change i.e. {{ if eq .Section "resources" }}
But search.json file is not getting created in dist or anythwere for resources so the search does not work , but blogs still works.
What may be the issue ?
Config.toml has below code
[outputs]
home = [ “HTML”, “RSS”, “JSON”]
Need help.