This is a text-only version of the following page on https://raymii.org:
---
Title       : 	Site updates, raymii.org now also available on Gopher
Author      : 	Remy van Elst
Date        : 	10-03-2019
URL         : 	https://raymii.org/s/blog/Site_updates_raymii.org_now_on_gopher.html
Format      : 	Markdown/HTML
---



### 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][1] using your favorite gopher browser
(`lynx` or [DiggieDog for Android][2]) 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][3]

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][4]. 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.

![][5]

### Static site generator

Due to [this excellent guide][6] 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][7]

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][8].

[Last year I did some site updates focussed on accessibility][9].

<p class="ad"> <b>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:</b><br><br> <a href="https://leafnode.nl">I'm developing an open source monitoring app called  Leaf Node Monitoring, for windows, linux & android. Go check it out!</a><br><br> <a href="https://github.com/sponsors/RaymiiOrg/">Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.</a><br><br> <a href="https://www.digitalocean.com/?refcode=7435ae6b8212">You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days. </a><br><br> </p>


   [1]: gopher://raymii.org:70/
   [2]: https://play.google.com/store/apps/details?id=com.afewroosloose.gopher&hl=en_US
   [3]: https://gopher.floodgap.com/gopher/gw?a=gopher%3A%2F%2Fraymii.org%3A70%2F
   [4]: http://web.archive.org/web/20190310082022/https://prgmr.com/blog/gopher/2018/08/23/gopher.html
   [5]: https://raymii.org/s/inc/img/gopher.png
   [6]: https://prgmr.com/blog/gopher/2018/11/09/setting-up-gopherserver.html
   [7]: https://github.com/RaymiiOrg/raymiiorg.github.io/tree/master/gopher/gophermap
   [8]: https://raymii.org/s/static/About.html
   [9]: https://raymii.org/s/blog/Site_Improvements_for_accessibility.html
   [10]: https://www.digitalocean.com/?refcode=7435ae6b8212

---

License:
All the text on this website is free as in freedom unless stated otherwise. 
This means you can use it in any way you want, you can copy it, change it 
the way you like and republish it, as long as you release the (modified) 
content under the same license to give others the same freedoms you've got 
and place my name and a link to this site with the article as source.

This site uses Google Analytics for statistics and Google Adwords for 
advertisements. You are tracked and Google knows everything about you. 
Use an adblocker like ublock-origin if you don't want it.

All the code on this website is licensed under the GNU GPL v3 license 
unless already licensed under a license which does not allows this form 
of licensing or if another license is stated on that page / in that software:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Just to be clear, the information on this website is for meant for educational 
purposes and you use it at your own risk. I do not take responsibility if you 
screw something up. Use common sense, do not 'rm -rf /' as root for example. 
If you have any questions then do not hesitate to contact me.

See https://raymii.org/s/static/About.html for details.