Build a webpage with multiple RSS entries (on the same page)
I attended a workshop ran by Well Gedacht Publishing.
The aim of the workshop was to teach people how to publish a simple webpage with an RSS feed and upload it to a “friend’s server” (someone you know running a webserver).
The workshop covered:
- usage of Pandoc to convert a rich text file into HTML
- usage of RSS feeds to propagate updates/news
- usage of
ssh
andscp
to send files to a friend’s server
There were many topics covered during the workshop: how to use Pandoc to build an HTML page, how to host webserver on a computer at home, etc - for me it was interesting to play with RSS.
I’ve been using RSS for while, but I had never wrote an RSS feed myself. The static site generator I use to build websites always constructs RSS feeds automatically.
So during the workshop, I put together an RSS feed with 3 entries.
All 3 entries live on the same webpage.
New entries can be added on the webpage, and in the RSS feed.
Anyone can subscribe to the feed.
Think of it as “newsfeeds” or “timelines” you can find on social media website.
In a way, this exercise is a little bit like building your own newsfeed or timeline, on your own website, which other people can subscribe to - in the way that they would “follow you” on social media platforms.
The file where the RSS feed lives is to be updated manually.
That’s one entry:
<item>
<title>Hello, world</title>
<link>https://yctct.selfhostingworkshop.work#helloworld</link>
<description>
<![CDATA[
<pre>
__ __ ____ __ __
/ / / /__ / / /___ _ ______ _____/ /___/ /
/ /_/ / _ \/ / / __ \ | | /| / / __ \/ ___/ / __ /
/ __ / __/ / / /_/ / | |/ |/ / /_/ / / / / /_/ /_
/_/ /_/\___/_/_/\____( ) |__/|__/\____/_/ /_/\__,_/(_)
</pre>
]]> </description>
</item>
You can see that an entry (that is the item
) has a title, a link and some content (called the description
). That’s it.
The whole RSS feed looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>A WEBSITE</title>
<link>https://yctct.selfhostingworkshop.work</link>
<description>A website with rabbits and more</description>
<item>
<title>Hello, world</title>
<link>https://yctct.selfhostingworkshop.work#helloworld</link>
<description>
<![CDATA[
<pre>
__ __ ____ __ __
/ / / /__ / / /___ _ ______ _____/ /___/ /
/ /_/ / _ \/ / / __ \ | | /| / / __ \/ ___/ / __ /
/ __ / __/ / / /_/ / | |/ |/ / /_/ / / / / /_/ /_
/_/ /_/\___/_/_/\____( ) |__/|__/\____/_/ /_/\__,_/(_)
</pre>
]]> </description>
</item>
<item>
<title>Rabbit</title>
<link>https://yctct.selfhostingworkshop.work#rabbit</link>
<description>
<![CDATA[
<p>This is a rabbit:</p>
<p><img src="./rabbit70.png" /></p>
<p>made by the hammer dreamer (not me).</p>
]]>
</description>
</item>
<item>
<title>Cow</title>
<link>https://ciao.selfhostingworkshop.work#cow</link>
<description>
<![CDATA[
<p>This is a cow, saying ciao:</p>
<p>(it’s fiction, hej)</p>
<pre>
______
< ciao >
------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
</pre>
]]>
</description>
</item>
</channel>
</rss>
All you have to do is put your entries in between channels
and rss
tags, and you have a feed.
In order to link to each of the items (because they’re on the same page which has a unique URL), I added tags on the webpage, and at the end of each of the three slugs in the RSS feed.
In my RSS reader, newsboat, the 3 entries show up as:
A single entry shows up as:
And this is what the webpage looks like:
You can use this syntax above to create your own RSS feed on a single webpage which you can deploy via Codeberg Pages (or on your friend’s server). Once you have this running, you can send updates to people via RSS.
You can find all the files of the website there: https://yctct.com/website_wgp.zip
Sources
For the RSS file: https://toolkit.wellgedacht.org/doku.php?id=guides:rss
For the CSS https://toolkit.wellgedacht.org/doku.php?id=articles:digital-publishing
For Pandoc, I went directly from Markdown to HTML using:
$ pandoc webpage.md -f markdown --css style.css -t html -s -o index.html
This also works:
$ pandoc -s -o index.html webpage.md --css style.css
personal computing command-line interface (cli) gnu linux trisquel office applications wiki publishing