From 9a663b328af938a1d8912465a540bf00684b7024 Mon Sep 17 00:00:00 2001
From: Brandon Rozek
Date: Wed, 2 Apr 2025 00:00:30 -0400
Subject: [PATCH] Adjusting postroll RSS/Atom/JSONFeed
---
layouts/postroll/item.json.json | 12 +++++++++
layouts/postroll/list.atom.atom | 41 ++++++++++++++++++++++++++++++
layouts/postroll/rss.xml | 44 +++++++++++++++++++++++++++++++++
3 files changed, 97 insertions(+)
create mode 100644 layouts/postroll/item.json.json
create mode 100644 layouts/postroll/list.atom.atom
create mode 100644 layouts/postroll/rss.xml
diff --git a/layouts/postroll/item.json.json b/layouts/postroll/item.json.json
new file mode 100644
index 0000000..155c62a
--- /dev/null
+++ b/layouts/postroll/item.json.json
@@ -0,0 +1,12 @@
+{
+ "id": "{{ .Params.url }}",
+ "url": "{{ .Params.url }}",
+ "title": {{ .Title | jsonify }},
+ "authors": ["{{ .Params.author }}"],
+ {{ $pre := "Brandon's Comment:
" }}
+ {{ $content := .Content }}
+ {{ $combined := printf "%s%s" $pre $content}}
+ {{ $combined := $combined | jsonify (dict "noHTMLEscape" true) }}
+ "content_html": {{ $combined }},
+ "date_published": "{{ .Date.Format "2006.01.02" }}"
+}
\ No newline at end of file
diff --git a/layouts/postroll/list.atom.atom b/layouts/postroll/list.atom.atom
new file mode 100644
index 0000000..acf55e2
--- /dev/null
+++ b/layouts/postroll/list.atom.atom
@@ -0,0 +1,41 @@
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := $pctx.RegularPages -}}
+{{- $limit := .Site.Config.Services.RSS.Limit -}}
+{{- if ge $limit 1 -}}
+{{- $pages = $pages | first $limit -}}
+{{- end -}}
+{{- printf "" | safeHTML }}
+
+ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} | {{ end }}{{ .Site.Title }}{{ end }}
+ {{ .Permalink }}
+ Hugo
+
+ {{ .Site.BaseURL }}
+ {{ with .Site.Params.Author }}{{.}}{{end}}
+
+ {{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }}
+ {{ with .OutputFormats.Get "Atom" }}
+ {{ printf "" .Permalink .MediaType | safeHTML }}
+ {{ end }}
+ {{ range $pages }}
+
+
+ http://activitystrea.ms/schema/1.0/person
+ {{ .Params.author }}
+
+ http://activitystrea.ms/schema/1.0/article
+ {{ .Title }}
+ {{ .Params.url }}
+ {{ printf `Brandon's Comment:
%s]]>` .Content | safeHTML }}
+ http://activitystrea.ms/schema/1.0/create
+ {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
+
+ {{ end }}
+
\ No newline at end of file
diff --git a/layouts/postroll/rss.xml b/layouts/postroll/rss.xml
new file mode 100644
index 0000000..506221d
--- /dev/null
+++ b/layouts/postroll/rss.xml
@@ -0,0 +1,44 @@
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := $pctx.RegularPages -}}
+{{- $limit := .Site.Config.Services.RSS.Limit -}}
+{{- if ge $limit 1 -}}
+{{- $pages = $pages | first $limit -}}
+{{- end -}}
+{{- printf "" | safeHTML }}
+{{- $style := resources.Get "css/pretty-feed-v3.xsl" -}}
+{{- printf "" $style.Permalink | safeHTML }}
+
+
+ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} | {{ end }}{{ .Site.Title }}{{ end }}
+ {{ .Permalink }}
+
+ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} | {{ end }}{{ .Site.Title }}{{ end }}
+ {{ .Permalink }}
+ {{ .Site.BaseURL }}img/{{ .Site.Params.avatar }}
+
+ {{ .Description }}
+ Hugo -- gohugo.io{{ with .Site.LanguageCode }}
+ {{.}}{{end}}{{ with .Site.Params.email }}
+ {{.}}{{ with $.Site.Params.Author }} ({{.}}){{end}}{{end}}{{ with .Site.Params.email }}
+ {{.}}{{ with $.Site.Params.Author }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }}
+ {{.}}{{end}}{{ if not .Date.IsZero }}
+ {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }}
+ {{ with .OutputFormats.Get "RSS" }}
+ {{ printf "" .Permalink .MediaType | safeHTML }}
+ {{ end }}
+ {{ range $pages }}
+ -
+ {{ .Title }}
+ {{ .Params.url }}
+ {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
+ {{ .Params.author }}
+ {{ .Params.url }}
+ {{ printf `Brandon's Comment:%s]]>` .Summary | safeHTML }}
+ {{ printf `Brandon's Comment:%s]]>` .Content | safeHTML }}
+
+ {{ end }}
+
+
\ No newline at end of file