Skip to content

Commit

Permalink
added default view which outputs the entire content of the site in on…
Browse files Browse the repository at this point in the history
…e JSON
  • Loading branch information
DinisCruz committed Dec 8, 2024
1 parent 196a688 commit fa4d005
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ paginate = 10
blog = "/blog/:year/:month/:day/:filename/"

[outputs]
home = [ "HTML", "Algolia"]
home = [ "HTML", "Algolia", "Content"]

[outputFormats.Algolia]
baseName = "algolia"
isPlainText = true
mediaType = "application/json"

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

[params.algolia]
Expand Down
48 changes: 48 additions & 0 deletions layouts/_default/list.content.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{/* Generates dump of the site's content */}}
{{- $.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 -}}
{{- 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
"track" .Params.track
"project" .Params.project
"topics" .Params.topics
"event" .Params.event
"when_year" .Params.when_year
"when_month" .Params.when_month
"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
"content" .Content)}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}

0 comments on commit fa4d005

Please sign in to comment.