From bf1d45824563376491c721d36051545fceb1c10a Mon Sep 17 00:00:00 2001 From: tdro Date: Tue, 17 May 2022 04:22:38 -0400 Subject: themes/default/layouts/_default/rss: Style feed --- config.json | 14 +- config.toml | 13 +- config.yaml | 11 +- themes/default/layouts/_default/home.rss-style.xsl | 143 +++++++++++++++++++++ themes/default/layouts/_default/rss.xml | 8 +- 5 files changed, 183 insertions(+), 6 deletions(-) create mode 100644 themes/default/layouts/_default/home.rss-style.xsl diff --git a/config.json b/config.json index f800b12..e523e53 100644 --- a/config.json +++ b/config.json @@ -162,6 +162,13 @@ } } }, + "mediaTypes": { + "application/xslt+xml": { + "suffixes": [ + "xsl" + ] + } + }, "outputFormats": { "html": { "baseName": "index", @@ -173,7 +180,11 @@ }, "rss": { "baseName": "rss", - "mediaType": "application/xml" + "mediaType": "application/rss+xml" + }, + "rss-style": { + "baseName": "rss", + "mediaType": "application/xslt+xml" }, "authors": { "path": "authors", @@ -208,6 +219,7 @@ "home": [ "html", "rss", + "rss-style", "json", "authors", "sources", diff --git a/config.toml b/config.toml index 90a38c5..0f9e24f 100644 --- a/config.toml +++ b/config.toml @@ -115,6 +115,11 @@ enableRobotsTXT = true [params.search.verification] +[mediaTypes] + + [mediaTypes."application/xslt+xml"] + suffixes = ["xsl"] + [outputFormats] [outputFormats.html] @@ -127,7 +132,11 @@ enableRobotsTXT = true [outputFormats.rss] baseName = "rss" - mediaType = "application/xml" + mediaType = "application/rss+xml" + + [outputFormats.rss-style] + baseName = "rss" + mediaType = "application/xslt+xml" [outputFormats.authors] path = "authors" @@ -158,7 +167,7 @@ enableRobotsTXT = true mediaType = "application/manifest+json" [outputs] - home = ["html", "rss", "json", "authors", "sources", "browserconfig", "archive-messages", "archive-tags", "webmanifest"] + home = ["html", "rss", "rss-style", "json", "authors", "sources", "browserconfig", "archive-messages", "archive-tags", "webmanifest"] section = ["html", "rss"] taxonomy = ["html", "rss"] term = ["html", "rss"] diff --git a/config.yaml b/config.yaml index 4b00fed..be1b7d8 100644 --- a/config.yaml +++ b/config.yaml @@ -102,6 +102,11 @@ params: bing: yandex: +mediaTypes: + application/xslt+xml: + suffixes: + - xsl + outputFormats: html: baseName: index @@ -111,7 +116,10 @@ outputFormats: mediaType: application/json rss: baseName: rss - mediaType: application/xml + mediaType: application/rss+xml + rss-style: + baseName: rss + mediaType: application/xslt+xml authors: path: authors baseName: index @@ -139,6 +147,7 @@ outputs: home: - html - rss + - rss-style - json - authors - sources diff --git a/themes/default/layouts/_default/home.rss-style.xsl b/themes/default/layouts/_default/home.rss-style.xsl new file mode 100644 index 0000000..d7b0d23 --- /dev/null +++ b/themes/default/layouts/_default/home.rss-style.xsl @@ -0,0 +1,143 @@ +{{- print "" | safeHTML }} + + + + + + {{- print "<xsl:value-of select=\"/rss/channel/title\"/> Web Feed" | safeHTML }} + + + + + + + + +
+ + + + + + +
+ + + {{- $file := "/profile/picture.png" -}} + {{- $image := imageConfig (print "content/" (partial "author-media-path.html" .) $file) -}} + + + + {{ .Site.BaseURL }}//media/profile/picture.png + + + +
+
+ +

+ + + + +

+ Published: +
+
+
+
+
+
+ + + + +
+
diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index eac25c4..293541b 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -5,17 +5,21 @@ {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} {{- end -}} -{{- printf "" | safeHTML }} +{{- print "" | safeHTML }} +{{- print "" | safeHTML }} + {{ partial "site-title" . }} {{ .Permalink }} Recent from {{ partial "site-title" . }} {{ .Site.LanguageCode }} + {{ partial "author-user" . }} + {{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}/profile/picture.png {{- if not .Date.IsZero -}} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} {{ with .OutputFormats.Get "RSS" }} - {{- printf "" .Permalink "application/rss+xml" | safeHTML -}} + {{- printf "" .Permalink .MediaType | safeHTML -}} {{ end }} {{- range $pages -}} {{ if and (ne .Params.hidden true) (not .Params.Unlisted) (not .ExpiryDate) }} -- cgit v1.2.3