Add rss feed

This commit is contained in:
Never Gude 2026-02-12 00:43:19 +01:00
parent 857e0b65ac
commit 46807b2ba6
5 changed files with 119 additions and 9 deletions

View file

@ -17,7 +17,7 @@ style := $(STYLEDIR)/style.css
# Main html template that pandoc uses to generate .html from .md files
template_html := $(PANDOCDIR)/template.html
template_ansi := $(PANDOCDIR)/template
template_rss := $(PANDOCDIR)/rss-template.xml
# Template for extracting metadata of .md files in json format
list_template := $(PANDOCDIR)/meta-json-template.txt
@ -33,7 +33,7 @@ articles_md := $(wildcard $(SRCDIR)/$(ARTICLEDIR)/*.md)
articles_html := $(patsubst $(SRCDIR)/%.md, $(BUILDDIR)/%.html, $(articles_md))
articles_ansi := $(patsubst $(SRCDIR)/%.md, $(BUILDDIR)/%, $(articles_md))
all: $(BUILDDIR)/index.html $(BUILDDIR)/index
all: $(BUILDDIR)/index.html $(BUILDDIR)/index $(BUILDDIR)/rssfeed.xml
install:
cp -r $(BUILDDIR)/index.html $(articles_html) $(STYLEDIR) $(IMAGEDIR) $(INSTALLDIR_HTML); \
@ -48,13 +48,15 @@ $(BUILDDIR):
$(BUILDDIR)/$(ARTICLEDIR)/%.html: $(SRCDIR)/$(ARTICLEDIR)/%.md | $(BUILDDIR)
jq 'del(.articles[] | select(.filename == "$(patsubst %.html,%,$(notdir $@))"))' $(article_list) > articles.json.tmp; \
mv ./articles.json.tmp $(article_list); \
mv articles.json.tmp $(article_list); \
# Build articles using pandoc
pandoc $< --template $(template_html) --css $(style) --highlight-style zenburn --mathml --toc --output $@; \
# Extract metadata from .md file, append filename field to the article object.
# This is used to link to the article from index.html. Append article object to the article list.
jq '.articles += [$(shell pandoc $< --template $(list_template) | jq '. += {"filename": "$(patsubst %.html,%,$(notdir $@))"}')]' $(article_list) > articles.json.tmp; \
mv ./articles.json.tmp $(article_list);
jq '.articles += [$(shell pandoc $< --template $(list_template) | jq '. += {"filename": "$(patsubst %.html,%,$(notdir $@))", "pubdate": "$(shell date -d $(shell pandoc $< --template $(list_template) | jq '.date') --rfc-2822)"}')]' $(article_list) > articles.json.tmp; \
mv articles.json.tmp $(article_list);
$(BUILDDIR)/$(ARTICLEDIR)/%: $(SRCDIR)/$(ARTICLEDIR)/%.md | $(BUILDDIR)
pandoc $< --template $(template_ansi) --to ansi --output $@
@ -62,9 +64,13 @@ $(BUILDDIR)/$(ARTICLEDIR)/%: $(SRCDIR)/$(ARTICLEDIR)/%.md | $(BUILDDIR)
$(BUILDDIR)/index.html: $(SRCDIR)/index.md $(articles_html) | $(BUILDDIR)
# Sort articles decending by date (date need to be in ISO 8601 format)
jq '.articles |= sort_by(.date) | .articles |= reverse' ${article_list} > articles.json.tmp; \
mv ./articles.json.tmp ${article_list}; \
mv articles.json.tmp ${article_list}; \
# Build index.html with metadata injected from articles_list
pandoc $< --template $(template_html) --include-after-body $(shark_js) --css $(style) --metadata-file $(article_list) --highlight-style zenburn --mathml --toc --output $@;
$(BUILDDIR)/index: $(SRCDIR)/index.md $(articles_ansi) | $(BUILDDIR)
pandoc $< --template $(template_ansi) --metadata-file $(article_list) --to ansi --output $@
$(BUILDDIR)/rssfeed.xml: $(SRCDIR)/rssfeed.md $(articles_html) | $(BUILDDIR)
pandoc $< --template $(template_rss) --metadata-file $(article_list) --to html --output $@

41
build/rssfeed.xml Normal file
View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>nevereverever.de RSS Feed</title>
<link>https://nevereverever.de/eh/eh/eh-eh</link>
<description>RSS of my published articles</description>
<language>en-us</language>
<pubDate>Wed, 11 Feb 2026 23:26:41 +0100</pubDate>
<docs>https://www.rssboard.org/rss-specification</docs>
<generator>pandoc</generator>
<managingEditor>Never</managingEditor>
<webMaster>Never</webMaster>
<atom:link href="https://www.rssboard.org/files/sample-rss-2.xml" rel="self" type="application/rss+xml"/>
<item>
<title>Using rsync on Android to syncronise my Music library</title>
<link>https://nevereverever.de/eh/eh/eh-eh/rsync-android.html</link>
<description>As Spotify is getting enshittified by capitalism, keeping a
music library is kind of essential. Here I use rsync to syncronise my
library with my Android smartphone.</description>
<pubDate>Mon, 12 Jan 2026 00:00:00 +0100</pubDate>
<guid>rsync-android</guid>
</item>
<item>
<title>Latex Endeavors</title>
<link>https://nevereverever.de/eh/eh/eh-eh/latex-endeavors.html</link>
<description>Latex undoubtedly has some quirks. Some of them have a
rather unintuitive solution. In this article I cover some quirks and
solutions I have encountered.</description>
<pubDate>Fri, 09 Jan 2026 00:00:00 +0100</pubDate>
<guid>latex-endeavors</guid>
</item>
<item>
<title>Random linux utilities</title>
<link>https://nevereverever.de/eh/eh/eh-eh/random-linux-utils.html</link>
<description>Tricks and tools I learned about, while tweaking my Linux
sytem or trying to do productive things.</description>
<pubDate>Fri, 25 Jul 2025 00:00:00 +0200</pubDate>
<guid>random-linux-utils</guid>
</item>
</channel>
</rss>

51
pandoc/rss-template.xml Normal file
View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
$if(title)$
<title>$title$</title>
$endif$
$if(link)$
<link>$link$</link>
$endif$
$if(description)$
<description>$description$</description>
$endif$
$if(lang)$
<language>$lang$</language>
$endif$
$if(pubdate)$
<pubDate>$pubdate$</pubDate>
$endif$
$if(builddate)$
<lastBuildDate>$builddate$</lastBuildDate>
$endif$
<docs>https://www.rssboard.org/rss-specification</docs>
<generator>pandoc</generator>
$if(editor)$
<managingEditor>$editor$</managingEditor>
$endif$
$if(webmaster)$
<webMaster>$webmaster$</webMaster>
$endif$
<atom:link href="https://www.rssboard.org/files/sample-rss-2.xml" rel="self" type="application/rss+xml"/>
$for(articles)$
<item>
$if(articles.title)$
<title>$articles.title$</title>
$endif$
$if(articles.filename)$
<link>$link$/$articles.filename$.html</link>
$endif$
$if(articles.summary)$
<description>$articles.summary$</description>
$endif$
$if(articles.date)$
<pubDate>$articles.pubdate$</pubDate>
$endif$
$if(articles.filename)$
<guid>$articles.filename$</guid>
$endif$
</item>
$endfor$
</channel>
</rss>

View file

@ -5,7 +5,8 @@
"date": "2026-01-12",
"summary": "As Spotify is getting enshittified by capitalism, keeping a music library is kind of essential. Here I use rsync to syncronise my library with my Android smartphone.",
"title": "Using rsync on Android to syncronise my Music library",
"filename": "rsync-android"
"filename": "rsync-android",
"pubdate": "Mon, 12 Jan 2026 00:00:00 +0100"
},
{
"author": "Never",
@ -13,7 +14,8 @@
"subtitle": "Some unintuitive quirks of Latex",
"summary": "Latex undoubtedly has some quirks. Some of them have a rather unintuitive solution. In this article I cover some quirks and solutions I have encountered.",
"title": "Latex Endeavors",
"filename": "latex-endeavors"
"filename": "latex-endeavors",
"pubdate": "Fri, 09 Jan 2026 00:00:00 +0100"
},
{
"author": "Never",
@ -21,7 +23,8 @@
"subtitle": "Neat things I picked up along the way",
"summary": "Tricks and tools I learned about, while tweaking my Linux sytem or trying to do productive things.",
"title": "Random linux utilities",
"filename": "random-linux-utils"
"filename": "random-linux-utils",
"pubdate": "Fri, 25 Jul 2025 00:00:00 +0200"
}
]
}

9
src/rssfeed.md Normal file
View file

@ -0,0 +1,9 @@
---
title: nevereverever.de RSS Feed
link: https://nevereverever.de/eh/eh/eh-eh
description: RSS of my published articles
lang: en-us
pubdate: Wed, 11 Feb 2026 23:26:41 +0100
editor: Never
webmaster: Never
---