HTML tips

Linking to another directory

Of course, you can always link to another directory on your site by typing <a href="../../foo/bar/", but keeping track of all those ../s always gave me a headache.

Recently I discovered (thanks to a comment section on lobste.rs) that you can just type <a href="/foo/bar"> instead, and it’ll start from your base directory. Gamechanger for me, tbh. This doesn’t work when loading files locally, but that’s not a big deal for me personally.

Protocol-relative linking

I complained about this back when I was active in Geminispace, and multiple people informed me that it’s actually possible: //example.com will load example.com on whichever protocol you’re currently using! So if you want to link the HTML version on your website and the Gemini version on your capsule, you don’t have to make multiple different versions of the same page just to do so!