Skip to main content

Raymii.org Raymii.org Logo

Quis custodiet ipsos custodes?
Home | About | All pages | Cluster Status | RSS Feed

Site updates, raymii.org now also available on Gopher

Published: 10-03-2019 | Author: Remy van Elst | Text only version of this article


❗ This post is over four years old. It may no longer be up to date. Opinions may have changed.


Introduction to Gopher

I've made some new improvements to this website. Raymii.org is generated using my self-written static site generator named ingsoc and it now supports Gopher. You can browse to gopher://raymii.org:70 using your favorite gopher browser (lynx or DiggieDog for Android) to view all the articles here on gopherspace. If you don't have a gopher browser, you can use the floodgap http to gopher proxy

Gopher is a protocol for information transfer over the internet that was very popular before HTTP took over as the dominant protocol, but there is still a community of gopher users that prefer the simplicity of the protocol over the more complex and large protocols more often encountered. Note that not all browsers support gopher, or have incomplete support. If you want to know more about Gopher, read this article. The reason for me to add Gopher support for my site is just that I like tinkering and text-based simple stuff. Gopher fits that bill.

Static site generator

Due to this excellent guide on pygopherd and how to create a Gophermap (sort of index.html file) I was able to get up and running quickly. I made an Ansible playbook to install and configure Pygopherd and updated my static site generator to generate the gophermap

If you want to setup a gopher server, it can be as simple as:

apt-get install pygopherd

Afterwards, edit the file /var/gopher/gophermap. Or remove it and place files in /var/gopher.

My static site generator's gopher part is simple. It takes the Markdown files, uses the header for meta information like title and date and puts that meta information in a dict. Using a lambda and an OrderedDict the items are stored in another list, sorted by date:

gopherItems = collections.OrderedDict(sorted(parsedFiles.items(), reverse=True, key=lambda item: dateutil.parser.parse(item[1]['date'], dayfirst=True)))

The metadata looks like this:

title: "Site updates, raymii.org now also available on Gopher"
author: "Remy van Elst"
category: "blog"
date: "10-03-2019"

Then, using a for loop, every item is written to the gophermap file:

with open('gophermap', 'w') as gopherMapFile:
    for filename, values in gopherItems.items():
        itemLine  = "0" + str(values['title']) + " (" + str(values['date']) + ")\t"
        itemLine += str(filename) + ".txt\traymii.org\t70\n"
        gopherMapFile.write(itemLine)
    gopherMapFile.write("1This server runs on Pygopherd\t/devel/gopher/pygopherd\tgopher.quux.org\t70\n")
    gopherMapFile.close()

Not the most elegant Python, if I would write the generator from scratch today I'd probably use templates (jinja2), but this works fine for now.

There is a Gopher only RSS feed, which uses the regular RSS feed generator code and a gopher links section, which is a seperate gophermap in the links folder. It's filled via the config file of the static site generator:

gopherlinks: [
  {'host': 'serf.jpmens.net',     
   'path': '/', 
   'port': 70, 
   'gophertype': 1, 
   'label': "Jan Piet Mens' gopherspace"
  }
]

After all the files have been created, the generator does a git commit and a git push. The servers all poll the repository and if there are changes, they pull the new site. Hassle free deployment. After all, it's just static HTML.

Images and links are not handled yet. You basically get the Markdown I write on which this site is generated. Just as the plain text file link you can click at every article.

If you use the gopher version of Raymii.org, please let me know.

Last year I did some site updates focussed on accessibility.

Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:

I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!

Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.

You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.

Tags: blog , cli , gopher , ingsoc , lynx , python , raymiiorg , server , site , w3c