From e49d6953ddf47caeb31e380df728ba50a8a5ad73 Mon Sep 17 00:00:00 2001 From: nkatha23 Date: Sat, 4 Apr 2026 00:42:19 +0300 Subject: [PATCH] fix: add XSLT stylesheet to style /feed.xml in browser Visiting /feed.xml showed raw unstyled XML. Overrides the default feed templates for both Jekyll and Zola to inject an processing instruction, and adds feed.xslt.xml to render the feed as HTML with site styling. Fixes #87 --- _config.yml | 4 +- config.toml | 2 +- feed.xml | 28 ++++++++ feed.xslt.xml | 156 +++++++++++++++++++++++++++++++++++++++++++ static/feed.xslt.xml | 156 +++++++++++++++++++++++++++++++++++++++++++ templates/atom.xml | 31 +++++++++ 6 files changed, 374 insertions(+), 3 deletions(-) create mode 100644 feed.xml create mode 100644 feed.xslt.xml create mode 100644 static/feed.xslt.xml create mode 100644 templates/atom.xml diff --git a/_config.yml b/_config.yml index 8968ef7..27435c9 100755 --- a/_config.yml +++ b/_config.yml @@ -8,12 +8,12 @@ future: true # allow posts with future dates sass: sass_dir: assets/css - style: :compressed + style: "compressed" # Customise atom feed settings (this is where Jekyll-Feed gets configuration information) title: "BitDevsNBO" description: "BitDevsNBO is a meetup devoted to the research and development of Bitcoin." # Leave out some files -exclude: ['README.md', 'Gemfile', 'Gemfile.lock', '.sass-cache'] +exclude: ['README.md', 'Gemfile', 'Gemfile.lock', '.sass-cache', 'static', 'templates', 'config.toml'] diff --git a/config.toml b/config.toml index 5b81d68..fe8479d 100644 --- a/config.toml +++ b/config.toml @@ -19,7 +19,7 @@ highlight_code = true generate_feed = true -feed_filename = "rss.xml" +feed_filename = "feed.xml" [extra] # Put all your custom variables here diff --git a/feed.xml b/feed.xml new file mode 100644 index 0000000..ffdf048 --- /dev/null +++ b/feed.xml @@ -0,0 +1,28 @@ +--- +layout: none +--- + + + + Jekyll + + + {{ site.time | date_to_xmlschema }} + {{ page.url | absolute_url }} + {% if site.title %}{{ site.title | smartify | xml_escape }}{% endif %} + {% if site.description %}{{ site.description | xml_escape }}{% endif %} + {% for post in site.posts limit: 10 %} + + {{ post.title | smartify | xml_escape }} + + {{ post.date | date_to_xmlschema }} + {{ post.last_modified_at | default: post.date | date_to_xmlschema }} + {{ post.id | absolute_url }} + {{ post.content | xml_escape }} + + {{ post.author | default: site.author | xml_escape }} + + {% if post.excerpt %}{{ post.excerpt | xml_escape }}{% endif %} + + {% endfor %} + diff --git a/feed.xslt.xml b/feed.xslt.xml new file mode 100644 index 0000000..36a44e3 --- /dev/null +++ b/feed.xslt.xml @@ -0,0 +1,156 @@ + + + + + + + <xsl:value-of select="atom:feed/atom:title"/> - RSS Feed + + + + + +
+
+
+ +
+
==============================================================================================================================================================
+
+ +

RSS Feed

+

+ This is the Atom feed. + Subscribe by copying the URL below into your RSS reader. +

+
+ +
+ + +
+
+ + + + + + +
+ +
+
+ +
+ + +
+
+ + +
+
diff --git a/static/feed.xslt.xml b/static/feed.xslt.xml new file mode 100644 index 0000000..36a44e3 --- /dev/null +++ b/static/feed.xslt.xml @@ -0,0 +1,156 @@ + + + + + + + <xsl:value-of select="atom:feed/atom:title"/> - RSS Feed + + + + + +
+
+
+ +
+
==============================================================================================================================================================
+
+ +

RSS Feed

+

+ This is the Atom feed. + Subscribe by copying the URL below into your RSS reader. +

+
+ +
+ + +
+
+ + + + + + +
+ +
+
+ +
+ + +
+
+ + +
+
diff --git a/templates/atom.xml b/templates/atom.xml new file mode 100644 index 0000000..7b4b78c --- /dev/null +++ b/templates/atom.xml @@ -0,0 +1,31 @@ + + + + {{ config.title }} + {% if config.description %} + {{ config.description }} + {% endif %} + + + Zola + {{ last_updated | date(format="%+") }} + {{ get_url(path=config.feed_filename) }} + {% for page in pages %} + + {{ page.title }} + {{ page.date | date(format="%+") }} + {{ page.updated | default(value=page.date) | date(format="%+") }} + + {{ page.permalink }} + {% if page.authors %} + + {{ page.authors | join(sep=", ") }} + + {% endif %} + {{ page.content | safe }} + {% if page.summary %} + {{ page.summary | safe }} + {% endif %} + + {% endfor %} +