I just found out about PageFind for Hugo and within minutes I was able to set it up. I read the docs and it seems it only supports excluding selectors. Configuring how content is indexed | Pagefind
Since it works based off of elements seemingly and there isn’t a way for me to modify my templates where certain md files won’t be part of search. My idea is as follows but I can’t seem to figure out the syntax in Hugo (in the list.html files):
{{ $slicePagesToIgnore := slice "/about" "/foo" "/bar/baz" }}
{{ range $slicePagesToIgnore }}
{{ if eq .RelPermalink . }}
div< id="content" data-pagefind-ignore>
{{ else }}
<div id="content">
{{ end }}
{{ end }}
I get the error layouts/page/single.html<.RelPermalink>: can't evaluate field RelPermalink in type string. Seems RelParmaLink is available for .Page only.
Thank you very much. That’s a better solution. Much appreciated. Cheers.
If anyone would like to see it in action, test it out, perhaps give feedback, or see how the search works, or is interested in implementing it themselves,
I’ll have to disable to widgets/partials, then rebuild site, then rebuild my search for pagefind. That way I can get cleaner/better results.
If you search LSD, it shows pretty much every article, even non LSD articles that have a link to the LSD archives in a partial rendered in a page as if you type ‘LSD’, every instance of this string is listed.