Skip to content

Commit

Permalink
fix: gerneate algolia index objectID for page only (#171)
Browse files Browse the repository at this point in the history
- Refer to #13
  • Loading branch information
rootsongjc authored and Deturium committed Jul 30, 2019
1 parent a47d980 commit 9919be5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions layouts/_default/list.algolia.json
Expand Up @@ -2,8 +2,10 @@
{{- $.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" .UniqueID "date" .Date.UTC.Unix "description" .Description "dir" .Dir "fuzzywordcount" .FuzzyWordCount "kind" .Kind "lang" .Lang "lastmod" .Lastmod.UTC.Unix "permalink" .Permalink "publishdate" .PublishDate "readingtime" .ReadingTime "relpermalink" .RelPermalink "summary" .Summary "title" .Title "type" .Type "url" .URL "wordcount" .WordCount "tags" .Params.Tags "categories" .Params.Categories "author" .Params.Author "content" ((.Content|plainify|truncate 3300)))}}
{{- end -}}
{{- if and (not .Draft) (eq .Kind "page") -}}
{{- if or (and (.IsDescendant $section) (not .Params.private)) $section.IsHome -}}
{{- $.Scratch.Add "index" (dict "objectID" .UniqueID "date" .Date.UTC.Unix "description" .Description "dir" .Dir "fuzzywordcount" .FuzzyWordCount "kind" .Kind "lang" .Lang "lastmod" .Lastmod.UTC.Unix "permalink" .Permalink "publishdate" .PublishDate "readingtime" .ReadingTime "relpermalink" .RelPermalink "summary" .Summary "title" .Title "type" .Type "url" .URL "wordcount" .WordCount "tags" .Params.Tags "categories" .Params.Categories "author" .Params.Author "content" ((.Content|plainify|truncate 3300)))}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}

0 comments on commit 9919be5

Please sign in to comment.