2023-02-03
Index style
=> =========
Whenever you host a website or a Gemini capsule and your server
fetches an "index.html" or "index.gmi" file when a client asks for a
directory instead of a file, you have to ask yourself whether you want
to provide your documents as simple ".html" or ".gmi" files (with
meaningful file names) or as "index.html"/"index.gmi" files in
directories (which then have to carry names referring to the documents).
The former option is of course simpler, because you just have to write a
single document instead of having to create a directory first. (I've
also found a page once where the about page was explicitly linked to as
"about.html", as if this is also a matter of principle, but I can't find
the page any more.) This is also how it's usually done on Gopher, where
Gophermaps are usually really just index files in the true meaning of
the word. (It would also be way harder to write an entire article as a
Gophermap.) But there are also benefits to the latter option, which I
refer to as "index style".
One advantage is that you can leave out the file endings. If
your document is "example.com/article/index.html" instead of
"example.com/article.html", you can simply request
"example.com/article/" or even "example.com/article" to get it. So even
though the full path is longer, the path you would request is
significantly shorter. Of course you can also configure your server to
serve files even if the extension is missing in the request (I've even
seen ".html" extensions being stripped away from my requests (similar to
redirections, but I don't know if that's how it worked) on a site on
neocities.org), but just using "index style" works on most servers
without having to make additional configurations.
Another advantage is that you can assemble all files that belong
to a certain document in the directory that is "headed" by the index
file, and you don't have to make any adjustments if you don't have any
accompanying files yet, but decide to add some at a later point. This
applies to embedded image files in HTML documents for example, or
individual chapters of a larger document that you have split up. If you
have a Gemini capsule where you serve your documents in "index style",
and you want to mirror that capsule to the web, you can also convert all
"index.gmi" files to "index.html" files and keep both in the same
directory, for example. This way you can use the same root directory for
your Gemini server and your web server. (I've considered doing this
recently, actually.)
A third advantage is that you are less likely to end up with a
directory that doesn't have an index file (which might happen if you
would otherwise embed resources like images from a separate directory
without an index file, for example). This is mostly relevant for web
servers that don't generate index files automatically. But this also
makes it easier to "hide" automatically generated index files by
preventing their being generated in the first place (e.g. if want to
hide file modification times from users who don't know curl -I) if you
can't configre the server not to generate index files at all.
The big disadvantage, of course, is that *if* you want to have
automatically generated index files with file sizes and modification
times, then that won't work with "index style". (Since I'm thinking
about switching from Gemtext to plain text anyway, I'm also thinking
about using that functionality.)
EOF
text/plain
This content has been proxied by September (3851b).