From 7f1e2726464a1ba0c02e235ccdf49d862ffe2bd1 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Tue, 3 May 2022 12:16:40 +0200 Subject: [PATCH] added xsl style to feed --- assets/feed_style.xsl | 84 ++++++++++++++++++++++++++++++ layouts/_default/baseof.html | 1 + layouts/index.xml | 1 + layouts/partials/build_assets.html | 10 ++++ layouts/partials/head.html | 2 +- 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 assets/feed_style.xsl create mode 100644 layouts/partials/build_assets.html diff --git a/assets/feed_style.xsl b/assets/feed_style.xsl new file mode 100644 index 0000000..3ed58f5 --- /dev/null +++ b/assets/feed_style.xsl @@ -0,0 +1,84 @@ + + + + + + + <xsl:value-of select="/rss/channel/title"/> RSS Feed + + + + {{ $style := resources.Get "/scss/style.scss" | resources.ExecuteAsTemplate "/scss/style.scss" . | resources.ToCSS (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") | resources.Fingerprint "sha512" }} + + + + +
+

+ + +

+
+

This is a web feed, also known as an RSS feed. Subscribe by copying the URL into your RSS reader.

+
+
+
+ +
+ +
+
+
+
+

📄 Recent Posts

+ +
+

+
Published:
+
+
+
+
+ + +
+
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5d2b506..3b2bc96 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,6 +1,7 @@ {{- partial "head.html" . -}} + {{- partial "build_assets.html" . -}}
{{- partial "header.html" . -}} diff --git a/layouts/index.xml b/layouts/index.xml index 5f52ecc..155c39c 100644 --- a/layouts/index.xml +++ b/layouts/index.xml @@ -11,6 +11,7 @@ {{- $pages = $pages | first $limit -}} {{- end -}} {{- printf "" | safeHTML }} +{{- printf "" | safeHTML -}} {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} diff --git a/layouts/partials/build_assets.html b/layouts/partials/build_assets.html new file mode 100644 index 0000000..216434e --- /dev/null +++ b/layouts/partials/build_assets.html @@ -0,0 +1,10 @@ +{{/* + This partial builds non-standard assets (like xsl files) with the template + engine. It is necessary to do it this way to reduce user friction and + ensure that the file is there. +*/}} +{{ if .IsHome }} + {{ $feed_style_xsl_template := resources.Get "feed_style.xsl" }} + {{ $feed_style_xsl := $feed_style_xsl_template | resources.ExecuteAsTemplate "feed_style.xsl" . }} + {{ $noop := $feed_style_xsl.Permalink }} +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index dea271e..ba5b281 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -29,7 +29,7 @@ {{ end }} {{ $style := resources.Get "/scss/style.scss" | resources.ExecuteAsTemplate "/scss/style.scss" . | resources.ToCSS (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") | resources.Fingerprint "sha512" }} - + {{- partial "inject/head.html" . -}} {{- partial "head_meta_seo.html" . -}} {{- partial "head_meta_opengraph.html" . -}}