Structure of a Gopher Menu
Gopher pages are called menus. These are just like web pages in that they're written in plain text and feature links to just about anything. Other Gopher sites can be linked. Text and binary (image, MP3, excutable) files can be linked. There's not a whole lot the Web can deliver that Gopher can't.
(The difference between a gophermap and a Gopher menu isn't that important. I use the former when talking about the raw file you edit, and the latter when I'm talking about what gets displayed on the client, or the concepts in use in a menu.
I'll also be using the delta symbol, Δ, to stand in for tabs, as whitespace is obviously normally invisible. Tabs are very important in a gophermap; using them wrong will confuse a client. Pay close attention to the triangles.)
A sample gophermap
To start, here's the text of a gophermap. This is the main page of my Gopherhole, listed on Somnolescent's Gopher server.
1< SomnolescentΔ/Δgopher.somnolescent.netΔ70 "Yeah, we can take it Good excuse for an endless spree Good because we made it The world is falling down, and it may as well crash with me." .... mariteaux on Gopher .......................................... I'm mariteaux. I founded Somnolescent in 2014 and I've been tinkering and kicking around various projects involving writing, modding, music, and shit being utterly broken. Sometimes I wonder if I get off on it. This is gonna be a companion area to my main site. In addition to featuring all the lovely works featured there, my writing will be exclusive to Gopherspace. Drafts and essays await us both. 1WritingΔwriting/ 1MusicΔmusic/ 1Quake MapsΔmapping/ 1PhlogΔphlog/ hmari on the WWWΔURL:http://mariteaux.somnolescent.net/ And if you'd like to get in contact, I'm always active on Discord at mariteaux#1020. Failing that, mariteaux@somnolescent.net will do just fine. Say hi if you're not shy; if you're using Gopher, you're doing something right, anyway. ................................................................... "There's no telling what we'll do when we're free."
Note the simplicity of the syntax. A gophermap will mostly display exactly how it looks while you're editing it. If you were to visit my Gopherhole using the above link, it would look pretty much identical to the gophermap. It's as pure as WYSIWYG gets.
Something to keep in mind is that you should try to keep your lines under 70 characters or so. Clients can wrap text weirdly, so you're best off keeping each line short yourself.
Selectors
Links in Gopher menus are referred to as selectors. A selector is, in order, the type of file, the name of the selector, a tab space, and then a link to the file, generally. If you're linking to things off-site, or keeping things purely canonical, both the host server and the port are also required and tab-separated.
1PituophisΔprojects/pituophis/
This selector breaks down like this:
1
is the selector type. This tells the client what the link points to. A single letter or digit can refer to another menu, different types of files, or an external server. In this case, the1
points to another menu.Pituophis
is the selector name. This is what actually displays on the line.Δprojects/pituophis/
is the selector path. This is a relative path to the file or menu. Typically, there's only one menu per folder, so if you're linking to another menu, you need only link to the folder it's in, like HTML andindex.html
files.
Unlike HTML, selectors can't be mixed with normal text; they have to be on their own line. (Truly technically, all lines in a gophermap are selectors, but I'm trying not to confuse here.)
Selector types
Here's a table of all the selector types. Any marked as "non-canonical" are not part of the original standard, but most clients will support them anyway.
# | Type | Canonical? | Description |
---|---|---|---|
0 | Text file | Yes | A pure plain text file, preferably ASCII. Good for pretty much anything you want people to read directly in their client. |
1 | Gopher menu | Yes | Wherever the link leads, the client will render it as a Gopher menu. (This is how you link parts of your Gopherhole together.) | 2 | CCSO name-server | Yes | A very early database search protocol, mostly used for contact information. |
3 | Error | Yes | This is an exception handler built into the protocol. Don't use this in your menus. |
4 | BinHex (HQX) file | Yes | A way of encoding binary files as plain text. Common for sharing programs among Classic Mac OS users. |
5 | DOS binary archive | Yes | The equivalent to 4 for IBM compatibles and DOS machines. |
6 | uunencoded file | Yes | Similar to 4 and 5, but for Unix machines. |
7 | Full-text search server | Yes | For various systems that can be used to search and index a Gopher server. |
8 | Telnet server | Yes | Telnet was an early protocol for remote computer access. Not secure and not commonly used anymore. |
9 | Generic binary file | Yes | Any type of binary file. Generally, if you're not meant to read it in a text editor, it's a binary file. |
+ | Alternate server | Yes | A mirror server that can be used if the main one goes down. |
T | Telnet 3270 | Yes | An alternate version of telnet meant for use with IBM 3270 terminals. |
g | GIF image | Yes | GIF is a lossless image compression format with a limited palette. Usually used for images with animation. |
I | Generic image file | Yes | Any other type of image file. |
h | HTML document | No | A document using HTML for markup. This is how you link WWW servers on Gopher, generally. |
i | Information selector | No | Displays purely as plain text and links nowhere. You don't need this one; any line without tabs will be displayed as an informational selector in the vast majority of clients. |
s | Sound file | No | Any type of sound or audio file. I'd hesitate to use this; it apparently works for WAV files, but Netscape doesn't care for MP3s linked with this selector. When in doubt, just use the generic binary selector type. |
So what's all that nonsense mean for you?
- If you're trying to link to a text file: Use selector type
0
. - If you're trying to link to another Gopher menu: Use selector type
1
. - If you're trying to link to any kind of program, ZIP archive, or music file: Use selector type
9
. - If you're trying to link to an image: Use
g
if it's a GIF, and useI
if it's not. - If you're trying to link to a web page: Use
h
.
Globbing and gophertags (Bucktooth and Pituophis only!)
The sample menu I showed you up there isn't accurate to my actual Gopherhole. I've since updated my Gopherhole to extensively use a function called globbing, and it can save you a ton of time too. Bad news: it only works if your menus are hosted on a Bucktooth or Pituophis server.
Globbing allows you to use wildcard file names and match a ton of files in one go. Rather than listing out everything in a folder, you can use a glob selector to match everything in that folder you're interested in listing on a menu in a single line.
A glob selector looks like this:
1*Δ
In case you missed that, it's a selector type, a wildcard for the selector name, and then a tab. That's all you need. This glob selector will match everything in the same folder as the menu and list them as other menus, using the file names for the selector names.
Of course, with great power comes great responsibility. You can confuse yourself easily by mixing up the selector type and what you're selecting. If the example was something like this:
0*Δ
Everything matched would return as a text file. Naturally, folders aren't text files, and neither are images or music. As a result, you'll probably wanna narrow the glob selector down some.
I*.jpgΔ
This glob selector matches every JPG in the same folder as the menu and lists them as image selectors. If you have a folder full of JPGs, say, for artwork, this is very useful indeed.
You can use glob selectors to clean and sort your files, but still have them all listed on a single menu. As an example, the folder for my project Calelira features two folders inside it, one for stories (stories
) and one for my in-development ramblings (chronicles
). The menu looks something like this:
.... CHRONICLES OF CALELIRA ....................................... 0chronicles/*Δ .... STORIES ...................................................... 0stories/*Δ
Each glob selector matches everything that happens to sit inside the folder in question and returns it as a text file. Everything is still tidily on one menu, even though they're in separate folders. You could easily create even more complex glob selectors to, say, sort out a menu of character artwork:
.... CHARACTER SKETCHES ........................................... .... SEBASTIAN .................................................... Iseb/[Sketch] *.jpgΔ .... PENNY ........................................................ Ipenny/[Sketch] *.jpgΔ .... KEVIN ........................................................ Ikevin/[Sketch] *.jpgΔ
One final note about globbing is that it uses the file name as the selector name, instead of being able to set that per-selector. For folders, that might not be ideal, but both Bucktooth and Pituophis support an additional file, a gophertag, that gets substituted for the folder name when globbed. A gophertag is simply a text file named gophertag
that contains the true name of the folder it's in.
My music/
folder's gophertag reads:
Music and Demos
That's it, and that file is in the music/
folder. When that folder gets globbed, the selector name will appear as "Music and Demos", not "music". A lot nicer.
(Be careful, as gophertags will get matched if you glob carelessly and match everything in the folder.)