aboutsummaryrefslogtreecommitdiff
path: root/build/rss-hacks/index.html
diff options
context:
space:
mode:
authorBradley Taunt <bt@btxx.org>2024-06-08 13:43:37 -0400
committerBradley Taunt <bt@btxx.org>2024-06-08 13:43:37 -0400
commit16d28628aca9b2d356de31c319f5e7bc0f5b2b02 (patch)
tree11947abb71e38cbe75116871694a44c33d257763 /build/rss-hacks/index.html
parentdcfb172704f3afb68a30425029ec834be2883274 (diff)
Remove incorrectly generated files, fix up markdown articles
Diffstat (limited to 'build/rss-hacks/index.html')
-rw-r--r--build/rss-hacks/index.html30
1 files changed, 2 insertions, 28 deletions
diff --git a/build/rss-hacks/index.html b/build/rss-hacks/index.html
index d6d4ef5..ee6fdcd 100644
--- a/build/rss-hacks/index.html
+++ b/build/rss-hacks/index.html
@@ -3,11 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="dark light">
<link rel="icon" href="data:,">
<title>RSS Hacks With XSLT</title>
<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
-<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>
<nav>
@@ -16,63 +17,36 @@
<main>
<h1 id="rss-hacks-with-xslt">RSS Hacks With XSLT</h1>
-
<p>2022-05-23</p>
-
<p>In my spare time I&#8217;ve been further tinkering (hopefully for the better) with my humble Shinobi Website[^0] script. The most recent update in <code>patch-1</code> came with a solid amount of QoL improvements. If you&#8217;re interested, I wrote about it on the official Shinobi blog[^1].</p>
-
<p>The next feature I wanted to tackle was designing a custom layout for the XML files directly in the browser. I was greatly inspired to create something similar to Len Falken&#8217;s main directory listing[^2], since that blog was one of the original inspirations for Shinobi. I&#8217;m not able to copy what&#8217;s there though, since our feed builds are quite a bit different.</p>
-
<p>I then proceeded to fall down the XSLT rabbit hole.</p>
-
<h2 id="it-never-works-the-first-time-does-it">It Never Works the First Time, Does It?</h2>
-
<p>Since the shinobi script generates valid RSS code by default, I didn&#8217;t want to mess around <em>too</em> much via XSLT and risk breaking validation. I also wanted to keep the &#8220;plain text&#8221; look-and-feel for consistency with the rest of the site, even though the XSLT template would render into standard HTML. Minor CSS styling and placing the content directly inside <code>pre</code> tags solved these issues.</p>
-
<p>My first attempt was to use the available <code>sort</code> parameter (in XSL version 1.1+) targeting the <code>dc:date</code> type linked to the <code>pubDate</code> element:</p>
-
<pre><code>&#60;xsl:sort select="pubDate" data-type="dc:date" order="descending"&#47;&#62;
&#60;!-- each individual post&#39;s content here --&#62;
</code></pre>
-
<p>This did not work as intended. RSS 2.0 requires that the <code>pubDate</code> content is set to comply with the RFC-822 date-time[^3], which shinobi handles perfectly fine. The issue came from the XSL <code>sort</code> parameter not honoring this setting across all dates. My best guess is that it struggles to properly organize posts from their &#8220;month&#8221; parameter, so it sets the posts in order of date in what I refer to as &#8220;monthly sections&#8221;.</p>
-
<p>If anyone knows why this failed to consistently order the posts via <code>pubDate</code>, please let me know using the comment link below. I&#8217;m far from an XSLT expert and might have overlooked something painfully obvious!</p>
-
<h2 id="rss-hack-categories">RSS Hack: Categories</h2>
-
<p>After spending far too much time reading over documentation, official manual pages and Stack Overflow comments I gave up on the <code>dc:date</code> sort. I realized I could sort the posts much easier if they were converted into a format similar to ISO 8601. But <code>pubDate</code> is required to be in RFC-822, so I couldn&#8217;t alter that in the final XML file.</p>
-
<p>Then I remembered the <code>category</code> tag which shinobi does not utilize by default.</p>
-
<p>First I needed to convert the RFC-822 formatted date (found on the first line of all blog post text files) and render it inside a <code>category</code> tag. This was simple enough:</p>
-
<pre><code>$(date -j -f "%a, %d %b %Y" "$(head -n 1 $file)" +"%Y&#47;%m&#47;%d&#47;%u")
</code></pre>
-
<p>In a nutshell, this converts the RFC-822 date into the format &#8220;2022&#47;05&#47;24&#47;2&#8221;. Simple numbers that can be sorted much easier by XSL. Now all that was needed was setting to <code>sort</code> parameter properly:</p>
-
<pre><code>&#60;xsl:sort select="category" order="descending"&#47;&#62;
</code></pre>
-
<p>Everything worked perfectly and the RSS was still valid!</p>
-
<h3 id="patch-2-pending">Patch-2 Pending</h3>
-
<p>I&#8217;ve ported these changes over to this blog to perform some &#8220;in the wild&#8221; testing. You can see the custom feed list in your supported browser by visiting:</p>
-
<p><a href="https://pblog.bt.ht/feed.xml">https:&#47;&#47;pblog.bt.ht&#47;feed.xml</a></p>
-
<p>As for the shinobi project itself, I have not merged these updates into the main master branch (at the time of publishing this article). They can be found sitting on patch-2[^4]. My plan is to get this merged ASAP once a little more real-world testing is finished and I can include a better &#8220;setup&#47;install&#8221; section for newcomers.</p>
-
<h2 id="shinobi-updates">Shinobi Updates</h2>
-
<p>If you&#8217;re interested in more updates and details about the shinobi project itself, feel free to sub to that specific feed below. This post was more focused on hacking RSS parameters that happened to involve shinobi, but in the future all updates specific to the project will be posted there:</p>
-
<p><a href="https://shinobi.bt.ht/feed.xml">https:&#47;&#47;shinobi.bt.ht&#47;feed.xml</a></p>
-
<h2 id="refs">Refs</h2>
-
<ol>
<li><a href="https://shinobi.website/">https:&#47;&#47;shinobi.website&#47;</a></li>
<li><a href="https://shinobi.website/posts/patch-1.txt">https:&#47;&#47;shinobi.website&#47;posts&#47;patch-1.txt</a></li>