diff options
| author | Bradley Taunt <bt@btxx.org> | 2025-01-20 15:39:24 -0500 |
|---|---|---|
| committer | Bradley Taunt <bt@btxx.org> | 2025-01-20 15:39:24 -0500 |
| commit | c0673c23500eadb6d268b9650a4c79f1f4de4f4d (patch) | |
| tree | 20b3b48623879ea9c689a123949eb2a9d2e5b4aa /posts/rss-hacks.md | |
| parent | 2fb22bc24f246c082bed0aca7cbee284fe26d71a (diff) | |
Minimal stylin changes, about page, table cleanup
Diffstat (limited to 'posts/rss-hacks.md')
| -rw-r--r-- | posts/rss-hacks.md | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/posts/rss-hacks.md b/posts/rss-hacks.md index 3d1890c..666d72c 100644 --- a/posts/rss-hacks.md +++ b/posts/rss-hacks.md @@ -15,8 +15,10 @@ Since the shinobi script generates valid RSS code by default, I didn't want to m My first attempt was to use the available `sort` parameter (in XSL version 1.1+) targeting the `dc:date` type linked to the `pubDate` element: - <xsl:sort select="pubDate" data-type="dc:date" order="descending"/> - <!-- each individual post's content here --> +~~~html +<xsl:sort select="pubDate" data-type="dc:date" order="descending"/> +<!-- each individual post's content here --> +~~~ This did not work as intended. RSS 2.0 requires that the `pubDate` content is set to comply with the RFC-822 date-time[^4], which shinobi handles perfectly fine. The issue came from the XSL `sort` parameter not honoring this setting across all dates. My best guess is that it struggles to properly organize posts from their "month" parameter, so it sets the posts in order of date in what I refer to as "monthly sections". @@ -32,13 +34,17 @@ Then I remembered the `category` tag which shinobi does not utilize by default. 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 `category` tag. This was simple enough: - $(date -j -f "%a, %d %b %Y" "$(head -n 1 $file)" +"%Y/%m/%d/%u") +~~~sh +$(date -j -f "%a, %d %b %Y" "$(head -n 1 $file)" +"%Y/%m/%d/%u") +~~~ In a nutshell, this converts the RFC-822 date into the format "2022/05/24/2". Simple numbers that can be sorted much easier by XSL. Now all that was needed was setting to `sort` parameter properly: - <xsl:sort select="category" order="descending"/> +~~~sh +<xsl:sort select="category" order="descending"/> +~~~ Everything worked perfectly and the RSS was still valid! |
