Add an RSS feed, close #2

This commit is contained in:
~lucidiot 2021-03-23 23:37:00 +01:00
parent 97d6d755e1
commit 44b4319318
3 changed files with 50 additions and 12 deletions

View File

@ -32,16 +32,6 @@ for file in content/**/*.md; do
convert "$file" "$output"
done
# Build the 'everything' page
echo "---
title: everything
---
" > "$tree_file"
pushd html >/dev/null
tree --du --si -X --prune -P '*.html' | xsltproc ../xsl/tree.xsl - >> "$tree_file"
popd >/dev/null
convert "$tree_file" "html/everything.html"
function link_assets {
for src in "$1"/*; do
dest="${src/#assets/html}"
@ -53,5 +43,52 @@ function link_assets {
fi
done
}
link_assets assets
# Build the 'everything' page
echo "---
title: everything
---
" > "$tree_file"
pushd html >/dev/null
tree --du --si -X --prune -P '*.html' | xsltproc ../xsl/tree.xsl - >> "$tree_file"
popd >/dev/null
convert "$tree_file" "html/everything.html"
# Build an RSS feed
echo '<?xml version="1.0"?>
<rss
version="2.0"
xmlns:admin="http://webns.net/mvcb/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<channel>
<title>~lucidiot'"'"'s wiki</title>
<link>https://envs.net/~lucidiot/</link>
<description>latest articles on ~lucidiot'"'"'s personal wiki</description>
<language>en-FR</language>
<copyright>Creative Commons BY 4.0 International, ~lucidiot</copyright>
<managingEditor>lucidiot@envs.net (lucidiot)</managingEditor>
<webMaster>lucidiot@envs.net (lucidiot)</webMaster>
<generator>/bin/bash</generator>
<docs>https://www.rssboard.org/rss-specification</docs>
<admin:errorReportsTo rdf:resource="mailto:lucidiot@envs.net" />
<admin:generatorAgent rdf:resource="https://tildegit.org/lucidiot/wiki/" />
<atom:link rel="self" type="application/rss+xml" href="https://envs.net/~lucidiot/rss.xml" />
' > html/rss.xml
for file in content/**/*.md; do
link="${file/#content/html}"
link="https://envs.net/~lucidiot/${link/%.md/.html}"
echo '<item>
<title>'"$(sed -n 's|\s*title:\(.*\)$|\1|p' "$file")"'</title>
<pubDate>'"$(date -Rd "@$(stat -c%Y "$file")")"'</pubDate>
<link>'"$link"'</link>
<guid>'"$link"'</guid>
</item>' >> html/rss.xml
done
echo ' </channel>
</rss>' >> html/rss.xml
chmod 644 html/rss.xml

View File

@ -8,6 +8,7 @@ title: feeds
* [a quest to identify plants](//tilde.town/~lucidiot/plants/feed.xml)
* [#fridaypostcard](//tilde.town/~lucidiot/fridaypostcard.xml)
* [rsrsss](./rsrsss/)
* [this wiki](./rss.xml)
## twtxt
@ -21,6 +22,5 @@ title: feeds
## planned feeds
* updates on this wiki
* my breadsite
* rocket launches, with georss and/or eventrss support

View File

@ -1 +1,2 @@
<link rel="shortcut icon" type="image/x-icon" href="/~lucidiot/img/favicon.ico" />
<link rel="alternate" type="application/rss+xml" href="/~lucidiot/rss.xml" title="latest articles" />