Skip to content

Conflicting file name: layouts/index.json #726

Answered by razonyang
FuadEfendi asked this question in Q&A
Discussion options

You must be logged in to vote

Oh, sorry about that, I forgot the Hugo look up order totally.

In this case, you'll need to place your template to layouts folder to get higher priority.

Move the JSON template to layouts/home.algolia.json should works.

And the template syntax seems outdated, can't build, I modified a bit to make site buildable.

{{/* Generates a valid Algolia search index */}}
{{- $.Scratch.Add "index" slice -}}
{{- $section := $.Site.GetPage "section" .Section }}
{{- range .Site.AllPages -}}
  {{- if or (and (.IsDescendant $section) (and (not .Draft) (not .Params.private))) $section.IsHome -}}
    {{- $.Scratch.Add "index" (dict "objectID" .File.UniqueID
"fuzzywordcount" .FuzzyWordCount
"keywords" .Keywo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by FuadEfendi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants