Algolia Implementation in HUGO site
Here I am trying to generate JSON output data for my blog page only for the algolia implementation.
I followed this article https://www.bennet.org/blog/site-search-jamstack-hugo-algolia/ for algolia implementation. which generates output for all pages of my site. And i want to make searchable my blogs only.
Here i am writing my code for generate output.
{{- $index := slice -}}
{{- range $page := $.Site.RegularPages -}}
{{- $page := . -}}
{{- $chunked := slice -}}
{{- $post_len := len .PlainWords -}}
{{- range $i := (seq 0 100000000000 $post_len) -}}
{{- $chunked = $chunked | append (delimit (first 100000000 (after $i $page.PlainWords) ) " " ) -}}
{{- end -}}
{{- range $i, $c := $chunked -}}
{{- $index = $index | append (dict "objectID" (print $page.File.UniqueID "_" $i) "content" $c "order" $i "title" $page.Title "summary" $page.Summary "categories" $page.Params.categories "types" $page.Params.types "image" $page.Params.image "date" $page.Date "href" $page.Permalink "tags" $page.Params.tags ) -}}
{{- end -}}
{{- end -}}
{{- $index | jsonify -}}
Please help me out !!!