Skip to content

Commit

Permalink
improved algolia and content json files
Browse files Browse the repository at this point in the history
  • Loading branch information
DinisCruz committed Dec 8, 2024
1 parent fa4d005 commit 9510206
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 39 deletions.
3 changes: 2 additions & 1 deletion config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ home = [ "HTML", "Algolia", "Content"]
baseName = "algolia"
isPlainText = true
mediaType = "application/json"
notAlternative = true

[outputFormats.Content]
baseName = "content"
isPlainText = true
mediaType = "application/json"
notAlternative = true


[params.algolia]
vars = ["title", "summary", "date", "publishdate", "expirydate", "permalink"]
Expand Down
54 changes: 26 additions & 28 deletions layouts/_default/list.algolia.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
{{/* Generates a valid Algolia search index */}}
{{- $.Scratch.Add "index" slice -}}
{{- $section := $.Site.GetPage "section" .Section }}
{{- $.Scratch.Add "algolia_index" slice -}}
{{- range .Site.AllPages -}}
{{- if or (and (.IsDescendant $section) (and (not .Draft) (not .Params.private))) $section.IsHome -}}
{{- if and (not .Draft) (not .Params.private) -}}
{{- if .File -}}
{{- $.Scratch.Add "index" (dict "objectID" .File.UniqueID
"date" .Date.UTC.Unix
"description" .Description
"dir" .File.Dir
"expirydate" .ExpiryDate.UTC.Unix
"fuzzywordcount" .FuzzyWordCount
"keywords" .Keywords
"kind" .Kind
"lang" .Lang
"lastmod" .Lastmod.UTC.Unix
"permalink" .Permalink
"publishdate" .PublishDate
"readingtime" .ReadingTime
"relpermalink" .RelPermalink
"summary" .Summary
"title" .Title
"type" .Type
"url" .RelPermalink
"weight" .Weight
"wordcount" .WordCount
"section" .Section
"tags" .Params.Tags
"categories" .Params.Categories
"authors" .Params.Authors)}}
{{- $.Scratch.Add "algolia_index" (dict "objectID" .File.UniqueID
"date" .Date.UTC.Unix
"description" .Description
"dir" .File.Dir
"expirydate" .ExpiryDate.UTC.Unix
"fuzzywordcount" .FuzzyWordCount
"keywords" .Keywords
"kind" .Kind
"lang" .Lang
"lastmod" .Lastmod.UTC.Unix
"permalink" .Permalink
"publishdate" .PublishDate
"readingtime" .ReadingTime
"relpermalink" .RelPermalink
"summary" .Summary
"title" .Title
"type" .Type
"url" .RelPermalink
"weight" .Weight
"wordcount" .WordCount
"section" .Section
"tags" .Params.Tags
"authors" .Params.Authors)}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}
{{- $.Scratch.Get "algolia_index" | jsonify -}}
16 changes: 6 additions & 10 deletions layouts/_default/list.content.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,27 @@
{{- range .Site.AllPages -}}
{{- if or (and (.IsDescendant $section) (and (not .Draft) (not .Params.private))) $section.IsHome -}}
{{- if .File -}}
{{- $.Scratch.Add "index" (dict "objectID" .File.UniqueID
{{- $.Scratch.Add "index" (dict "objectID" .File.UniqueID
"date" .Date.UTC.Unix
"description" .Description
"dir" .File.Dir
"expirydate" .ExpiryDate.UTC.Unix
"fuzzywordcount" .FuzzyWordCount
"keywords" .Keywords
"fuzzywordcount" .FuzzyWordCount
"kind" .Kind
"lang" .Lang
"layout" .Layout
"lastmod" .Lastmod.UTC.Unix
"permalink" .Permalink
"publishdate" .PublishDate
"readingtime" .ReadingTime
"relpermalink" .RelPermalink
"summary" .Summary
"section" .Section
"summary" .Summary
"title" .Title
"type" .Type
"url" .RelPermalink
"weight" .Weight
"wordcount" .WordCount
"section" .Section
"tags" .Params.Tags
"categories" .Params.Categories
"authors" .Params.Authors
"wordcount" .WordCount
"track" .Params.track
"project" .Params.project
"topics" .Params.topics
Expand All @@ -37,7 +34,6 @@
"when_day" .Params.when_day
"when_time" .Params.when_time
"hey_summit" .Params.hey_summit
"session_slack" .Params.session_slack
"organizers" .Params.organizers
"youtube_link" .Params.youtube_link
"zoom_link" .Params.zoom_link
Expand Down

0 comments on commit 9510206

Please sign in to comment.