openring + webring, build a suckless web

openring and webring are two orthogonal projects that are dedicated to build a decentralized web of independent blogs. The openring is a program written in GO that pulls RSS feeds from a list of URLs and render 3 of the newest articles into html that can be integrated into static site generators. The webring is a well maintained collection of blogs:

This webring is an attempt to inspire artists & developers to create and maintain their own personal websites, and share traffic among each other. The webring’s aim is to share rich hand-crafted websites such as diaries, wikis & portfolios. (from the webring README)

So here is the thing: why not both? I wrote some (perhaps ugly) codes to glue them together. Here is how:

A sweet combination

For this example: I’m using Hugo as my blog generator, but it’s pretty easy to opt in any static site generator. You need the openring (see url above) to render the feeds.

include webring contents into blog template:

in blog/themes/my-theme/layouts/index.html I have:

1
2
3
<div style="background:#000011; padding:1em">
{{ partial "webring.html" .}}
</div>

the webring.html partial can be simply an empty file, we will fill it up with openring later1.

create a template for openring
the openring project provides an example template in.html, you can simply use it. Here is a simpler version:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<div class="webring">
    {{range .Articles}}
    <div class="article">
        <a href="{{.Link}}" target="_blank" rel="noopener">{{.Title}}</a>
        <small class="date">
        via <a href="{{.SourceLink}}">{{.SourceTitle}}</a>
        {{.Date | datef "January 2, 2006"}}
        </small>
      <p>{{.Summary}}</p>
    </div>
    {{end}}
  <p class="attribution">
    Generated by
    <a href="https://git.sr.ht/~sircmpwn/openring">openring</a> from <a href="https://github.com/XXIIVV/webring">webring</a>
  </p>
</div> <!-- webring -->

fetch webring and render it into blog

Essentially, I have this one-liner to glue webring and openring together:

1
2
3
4
5
6
7
8
9
# for performance, limit the max number of URLs to pass to openring
limit=3

openring_in=<PATH TO openring template>
openring_out=<PATH TO webring partial>
webring_src="https://raw.githubusercontent.com/XXIIVV/webring/main/index.html"

rss_list=$(curl $webring_src | grep -Po '.*href="\K.*(?=" class="rss")' | shuf | head -$limit | sed -e 's/^/-s /')
openring $rss_list < $openring_in > $openring_out

A toplevel overview

XXIIVV/
webring       openring_template.html
  |                     |
  | $curl | grep        |
  |                     |
  v                     v
{rss urls} ---------> openring
                        |
                        v
                     webring.html
                        |
                        | (include partial)
                        v
                       hugo
                        |
                        V
                   +--------------+
                   | a better web |
                   +--------------+

disclaimer : ‘suckless’ in the title does not refer to suckless.org


  1. if you manage your blog with VCS, it’s better to exclude this file to avoid noise. ↩︎

Dec 7, 2023


[+] click to leave a comment [+]
the comment system on this blog works via email. The button
below will generate a mailto: link based on this page's url 
and invoke your email client - please edit the comment there!

[optional] even better, encrypt the email with my public key

- don't modify the subject field
- specify a nickname, otherwise your comment will be shown as   
  anonymous
- your email address will not be disclosed
- you agree that the comment is to be made public.
- to take down a comment, send the request via email.

>> SEND COMMENT <<




Fun with Image Maps and SVGs via benji February 20, 2024

Over the past few weeks I've been playing around with making some images on my website interactive. My "informatics" class in high school taught us some basic HTML. By basic I mean in notepad and writing everything by hand, saving to a...

Goblin Week 2024 via Helvetica Blanc January 26, 2024

It snuck up on me, but I managed to draw my little goblins to celebrate the week! I love my children - they're like awful Pikmin. I've uploaded the whole parade as a print, as well as individual prints for each goblin. There's something very fu…

How to trust gpg keys via Travis Shears Personal Site October 27, 2023

After moving some GPG keys to a new computer I kept getting these trust warnings. It is NOT certain that the key belongs to the person named in the user ID.If you * really * know what you are doing, you may answer the next question with yes. Use this key a…

Generated by openring from webring