Closed mntn-xyz closed 3 years ago
Still haven't done extensive testing, definitely need to test a few things before this is 100% ready... but it's closer now
OK, I think this is ready. Tested with TOML/YAML/JSON configs and a fairly complex site layout.
Some notes:
/index.gmi
from the end of leaf bundle posts, which cleans up the URLs.@mntn-xyz are you sure stripping index.gmi
in general is a good idea? I am specifically thinking about naive static servers which don't redirect to index.gmi
, dropping code 51
(not found) instead.
I don't know of any Gemini server feature comparison tables, unfortunately, neither can I tell the numbers and/or stats on server software people pick. I know Molly Brown will serve index.gmi
if it encounters a request to a directory, but more simplistic servers like Satellite (which is what I currently use myself) won't.
You're right, I'll roll that back. Hugo has the uglyURLs option, I could use uglyGeminiURLs... but it's not too hard for users who want clean URLs to roll their own templates.
OK, rolled it back and also added documentation.
Wanted to add one more thing, let me know what you think. If you drop rss.gotmpl in /gmnhg
, it will override RSS for the root dir. If you drop it in /gmnhg/_default
, it will override it for the whole site.
The convention I am using for overriding specific subdirectories is the same as for regular templates, but you append _rss to the name, like /gmnhg/top/blog_rss.gotmpl
.
LGTM
This relies on the site config to provide a custom GeminiBaseURL setting, as well as the site title, copyright, and language. Hopefully this could be useful elsewhere. I have only tested it with a TOML config so far but the others should work. I have also only tested with the default RSS template, I haven't tried to override it yet... so there may be bugs in that feature.
I decided that adding a "GeminiBaseURL" config option is probably the only solution besides a command line switch or extra config file. I've noticed that lots of people run their Gemini site on a separate subdomain from their main site.
Note: I made a change to topLevelPosts, and added an empty string key that holds everything. This gives both the RSS feed and the main index a way to easily access all posts. I had to update the main index template to avoid a change in behavior, but this was helpful for keeping the RSS generation code relatively clean.