2023-10-12 14:44:10
This commit is contained in:
parent
561dc49a3a
commit
79eae2be2f
5 changed files with 63 additions and 25 deletions
|
@ -1,35 +1,69 @@
|
|||
{{ ($.Scratch.Add "data" slice) }}
|
||||
{{ $data := (newScratch) }}
|
||||
|
||||
{{ ($.Scratch.Add "data" (dict
|
||||
"site" (dict
|
||||
"title" (site.Title)
|
||||
"description" (site.Params.description)
|
||||
"url" (site.BaseURL)
|
||||
)
|
||||
"page" (dict
|
||||
"title" ((.Page.Title) | plainify)
|
||||
"images" (.Page.Params.images)
|
||||
"description" (((((.Page.Description) | default (.Page.Summary)) | plainify) | chomp) | base64Encode)
|
||||
"content" (((.Page.Plain) | chomp) | base64Encode)
|
||||
"authors" (.Page.Params.authors)
|
||||
"categories" (.Page.Params.categories)
|
||||
"tags" (.Page.Params.tags)
|
||||
"url" (.Page.Permalink)
|
||||
"date" (dict
|
||||
{{ ($data.Add "authors" (slice)) }}
|
||||
{{ range (.GetTerms "authors") }}
|
||||
{{ ($data.Add "authors" (dict
|
||||
"name" (.Title)
|
||||
"url" (.Permalink)
|
||||
)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ ($data.Add "categories" (slice)) }}
|
||||
{{ range (.GetTerms "categories") }}
|
||||
{{ ($data.Add "categories" (dict
|
||||
"name" (.Title)
|
||||
"url" (.Permalink)
|
||||
)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ ($data.Add "tags" (slice)) }}
|
||||
{{ range (.GetTerms "tags") }}
|
||||
{{ ($data.Add "tags" (dict
|
||||
"name" (.Title)
|
||||
"url" (.Permalink)
|
||||
)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $date := (dict
|
||||
"created" (.Page.PublishDate.UTC.Format "2006-01-02T15:04:05Z07:00")
|
||||
"published" (.Page.PublishDate.UTC.Format "2006-01-02T15:04:05Z07:00")
|
||||
"modified" (.Page.Lastmod.UTC.Format "2006-01-02T15:04:05Z07:00")
|
||||
)
|
||||
"meta" (dict
|
||||
) }}
|
||||
|
||||
{{ $meta := (dict
|
||||
"type" (.Page.Type)
|
||||
"licenses" (.Page.Params.licenses)
|
||||
"license" (.Page.Params.license)
|
||||
"fid" (.File.UniqueID)
|
||||
"uuid" (.Page.Params.uuid)
|
||||
"sha1" (((.Page.Plain) | chomp) | sha1)
|
||||
"word_count" (.Page.WordCount)
|
||||
"read_time" (.Page.ReadingTime)
|
||||
)
|
||||
)
|
||||
)) }}
|
||||
) }}
|
||||
|
||||
{{ ((dict "data" (($.Scratch.Get "data") | uniq)) | jsonify) }}
|
||||
{{ $site := (dict
|
||||
"title" (site.Title)
|
||||
"description" (site.Params.description)
|
||||
"url" (("/") | absURL)
|
||||
"manifest" (("manifest.json") | absLangURL)
|
||||
"rss" (("index.xml") | absLangURL)
|
||||
) }}
|
||||
|
||||
{{ $page := (dict
|
||||
"title" ((.Page.Title) | plainify)
|
||||
"images" (.Page.Params.images)
|
||||
"description" (((((.Page.Description) | default (.Page.Summary)) | plainify) | chomp) | base64Encode)
|
||||
"content" (((.Page.Plain) | chomp) | base64Encode)
|
||||
"authors" ($data.Get "authors")
|
||||
"categories" ($data.Get "categories")
|
||||
"tags" ($data.Get "tags")
|
||||
"url" (.Page.Permalink)
|
||||
"date" ($date)
|
||||
"meta" ($meta)
|
||||
) }}
|
||||
|
||||
{{ $single := (dict
|
||||
"site" ($site)
|
||||
"page" ($page)
|
||||
) }}
|
||||
|
||||
{{ (($single) | jsonify) }}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
{{ $data := (newScratch) }}
|
||||
|
||||
{{ ($data.Add "categories" (slice)) }}
|
||||
|
||||
{{ range ($cfg.categories) }}
|
||||
{{ ($data.Add "categories" .) }}
|
||||
{{ end }}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
{{ $image := (index (.Param "images") 0) }}
|
||||
{{ $keywords := (delimit ((.Param "tags") | default (slice)) ", ") }}
|
||||
{{ $data := (newScratch) }}
|
||||
|
||||
{{ $mainEntityOfPage := (dict
|
||||
"@type" "WebPage"
|
||||
|
@ -24,8 +25,8 @@
|
|||
)
|
||||
) }}
|
||||
|
||||
{{ $data := (newScratch) }}
|
||||
{{ ($data.Add "authors" (slice)) }}
|
||||
|
||||
{{ range (.GetTerms "authors") }}
|
||||
{{ ($data.Add "authors" (dict
|
||||
"@type" "Person"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{{ $position := 0 }}
|
||||
{{ $data := (newScratch) }}
|
||||
|
||||
{{ ($data.Add "itemListElement" (slice)) }}
|
||||
|
||||
{{ range (.Ancestors.Reverse) }}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{{ $menu := (site.Menus.main) }}
|
||||
{{ $data := (newScratch) }}
|
||||
|
||||
{{ ($data.Add "itemListElement" (slice)) }}
|
||||
|
||||
{{ range ($menu) }}
|
||||
|
|
Loading…
Reference in a new issue