Gopher Power ============ *Last Update: 2020-04-27* It's no secret that I think Gopher is a wonderful protocol. What I find most intriguing though is that it feels like most people who use Gopher under utillize it. It's true that Gopher is extremely basic, and that's what we love about it! But there are still some features that can be combined in exciting new ways. The Gopher feature I see **most** under-utiliized is the gopher directory/menu. If you're using the gophernicus server, you can create your custom directory by adding a gophermap file to your folder. But just what is so under-utilized about the directory? Most people just let the gopher server produce a directory listing. This is woeful! The directory listing has so much more power! The power in the directory type comes with a single letter 'i'. The Gopher protocol specifies that 'i' is an informational line which mean that you can put whatever you want on it. The letter 'i' means *you can put whatever you want on that line!* Do you realize how awesome that is? That means that you can put text above, between, and beneath any links that you have to other locations on your gopher hole, or to external links. Sweet sassy! If you're using the popular gophernicus server, you place a file called gophermap in any directory and that will be rendered instead of the normal directory listing. In this gophermap file, the i is implied unless you have a tab character in the line. I found this out when I was trying to use a `===` heading bar. Gophernicus treats `=` as an include statement, so it was trying to include `==` (or more) as a filename. Of course that didn't make any sort of sense. But if I stuck `i` at the beginning then it just turned it into `i===`. What to do? Well, I realized that all the line needed was a tab character! So `i===\t` worked *perfectly*. The tab chcaracter fools gophernicus into requiring the leading i. Anyway, within the directory listing you can put text, but you can also link to other resources within your own gopher hole or a gopher hole anywhere else on the Internet. Not only can you link directly to files, you can also link to directory types. Or images. Or audio files. So you may not be able to produce content that's as free-form as you might with HTML, you can organize your thoughts and your content in arbitrary graphs. For instance, if you look at [my homepage][waynewerner.com], you will see that I have my main page, and from there I link to several sub-pages. Most of those link back to the home page. In Gopher you can do the same thing by using gophermap files (or the equivalent) but what's amazing about Gopher is that you can tell it that your flat file is a directory, and the client will believe it, and render your file like a directory. Text + links. Does that sound like anything you've used before? Just tell gopher that your file should be treated as a directory, and bam! It will be. Consider a simple webpage that has a home, a list of projects, a CV, and a blog. You could create it like so: ~/public_gopher/ |-- cv.map |-- gophermap |-- home.map |-- projects | |-- gallery | | `-- gophersnake | | |-- 01.jpg | | |-- 02.jpg | | `-- 03.jpg | `-- gophersnake.md `-- projects.map 3 directories, 8 files This is pretty basic, right? But you could totally present the same kind of information with this structure that you would have in a typical website. Your gophermap would be your "home" page. The other .map files are just files - nothing special about the extension, they could just be regular files. Or have other extensions. All that's important is that your gophermap could look like this (for gophernicus. `\t` means a real tab): My Homepage! i============\t 1My CV! /cv.map gopher.example.com 70 Looking for a Gopher expert? Hire me! 1Sweet Projects /projects.map gopher.example.com 70 Okay, projects is technically overkill, as I only have the one. But hey, I'll add more soon! Then your projects.map could look like this: My Sweet Sweet Projects i=======================\t 1Gophersnake /projects/gophersnake.map gopher.example.com 70 Gophersnake is my basic Gopher Server. It was shockingly simple to write! And your Gophersnake map could look something like this: Gophersnake i===========\t This is how I made gophersnake. First I went and found some sort of thing like this: Ithe thing I found /projects/gallery/gophersnake/01.jpg gopher.example.com 70 This is some information that I have aabout that first image, blah blah blah. IMy next image /projects/gallery/gophersnake/02.jpg gopher.example.com 70 This is more information about that other image. IFor my final trick /projects/gallery/gophersnake/03.jpg gopher.example.com 70 And finally I'm done here! For further reading check out someone else's site: 1Their Gopherhole / another.example.com 70 You can organize and present your content just swimmingly. Another approach, rather than using map files is that you could just use a CommonMark/Markdown file and give it 0 for text file. Since CommonMark is basically plain text anyway, the worst case is that they get readable text that they enjoy. You would provide links to your image like ![For my final trick](gopher://gopher.example.com/I/projects/gallery/gophersnake/03.jpg) (or use the `![For my final trick][01.jpg]` style) and your reader would be able to understand your post. But if they have a smart enough client, it would be able to render the CommonMark as HTML, and since it would know how to speak Gopher, it could actually render the images inline. Gopher gives you more power than you realize. For my next trick, I'll show you how to combine Gopher and Atom/RSS, because doesn't your phlog deserve it? -W [waynewerner.com]: https://www.waynewerner.com