Skip to main content

Raymii.org Logo (IEC resistor symbol)logo

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

Site updates, raymii.org now also available on Gopher

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


Table of Contents


Introduction to Gopher

I've made some new improvements to this website. Raymii.org is generated usingmy 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 ongopherspace. If you don't have a gopher browser, you can use the floodgap httpto gopher proxy

Gopher is a protocol for information transfer over the internet that was verypopular before HTTP took over as the dominant protocol, but there is still acommunity of gopher users that prefer the simplicity of the protocol over themore complex and large protocols more often encountered. Note that not allbrowsers support gopher, or have incomplete support. If you want to know moreabout Gopher, read this article. The reason for me to add Gopher supportfor my site is just that I like tinkering and text-based simple stuff. Gopherfits 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 anAnsible playbook to install and configure Pygopherd and updated my static sitegenerator 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 filesin /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 metainformation in a dict. Using a lambda and an OrderedDict the items arestored 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 todayI'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 codeand a gopher links section, which is a seperate gophermap in the linksfolder. 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 agit push. The servers all poll the repository and if there are changes, theypull 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 onwhich this site is generated. Just as the plain text file link you can click atevery article.

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

Last year I did some site updates focussed on accessibility.

If you like this article, consider sponsoring me by trying out a Digital OceanVPS. With this link you'll get $100 credit for 60 days). (referral link)

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