1
1
mirror of https://github.com/privacyguides/privacyguides.org.git synced 2026-05-14 15:41:17 +00:00

feat!: Add prebuild to grab Ghost posts

This commit is contained in:
2026-05-12 21:44:43 -05:00
parent c2bc69e29f
commit 5a6d219c29
3 changed files with 58 additions and 0 deletions
+11
View File
@@ -5,6 +5,17 @@ title: Privacy Guides
module:
imports:
- path: github.com/imfing/hextra
# mounts:
# - source: content
# target: content
# - source: prebuild/public/articles
# target: content/articles
# - source: prebuild/public/livestreams
# target: content/livestreams
# - source: prebuild/public/news
# target: content/news
# - source: prebuild/public/videos
# target: content/videos
markup:
# allow raw html
+7
View File
@@ -0,0 +1,7 @@
disableKinds:
- sitemap
- taxonomy
- term
outputs:
home:
- html
+40
View File
@@ -0,0 +1,40 @@
{{/* prebuild/layouts/index.html */}}
{{ $base := "https://www.privacyguides.org/ghost/api/content/posts/?key=a357e391ed3543ef0dad732ba4&include=tags,authors" }}
{{ $tags := slice "articles" "news" "videos" "livestreams" }}
{{ range $tags }}
{{ $taggedBase := printf "%s&filter=tag:%s" $base . }}
{{ $currentTag := . }}
{{ with resources.GetRemote $taggedBase }}
{{ $json := . | transform.Unmarshal }}
{{ $maxPages := $json.meta.pagination.pages }}
{{ range seq 1 $maxPages }}
{{ $page := . }}
{{ $url := printf "%s&page=%d" $taggedBase $page }}
{{ with resources.GetRemote $url }}
{{ $pagedData := . | transform.Unmarshal }}
{{ range $pagedData.posts }}
{{ $string := jsonify . }}
{{ $safeTitle := replace .title "/" "-" }}
{{ $filename := printf "%s/%s.md" $currentTag (urlize $safeTitle) }}
{{ $safeURL := replace .url "https://www.privacyguides.org/" "" }}
{{ $replace1 := replace $string "\"published_at\":\"" "\"date\":\"" }}
{{ $replace2 := replace $replace1 "\"updated_at\":\"" "\"modified\":\"" }}
{{ $replace3 := replace $replace2 "\"url\":\"https://www.privacyguides.org/" "\"url\":\"" }}
{{ $replace4 := printf "%s\n%s" $replace3 .html }}
{{ $resource := resources.FromString $filename $replace4 }}
{{ $file := $resource.RelPermalink }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}