4 ms·
Oh. Sorry. Overloaded term. URL location hash, not git hash. To see it, type `location.hash` in your browser's JavaScript console. If I want to render a page f
by murgindrag 6y ago
Oh. Sorry. Overloaded term. URL location hash, not git hash. To see it, type `location.hash` in your browser's JavaScript console.
If I want to render a page foo.md, I will go to:
http://server/wiki#page=foo http://server/wiki#page=foo
This is not how location hashes are meant to be used, mind you, and this breaks semantics, but it has the huge upside of running on any static web server, anywhere, including nothing but JavaScript. Until recently, it even ran on file:/// URLs, but that got nerfed a couple of years ago.
Nothing I have built there is rocket science, but it works really, really well. Including with completely non-technical people playing with my wikis.
- tomcam 6y ago> URL location hash, not git hash OH! I was flummoxed. That is super clever. It breaks semantics only by convention because of the missing question mark, right? Because technically that is a valid URL.
- murgindrag 6y agoSemantically, hashes are supposed to be used to point to different parts of a page, not to different pages. I'm breaking semantics. Lots of pages break semantics this way, though. It's a way to hack around being able to change the URL without a page reloading. That's worse for semantics, but better for performance. It can cause issues if you're not careful. For example, if I change just the hash, the page won't reload. On the other hand, it's not hard to be careful. You listen for hashchange events, and when one comes, you reload the body of the page. Of course, the upside is that it's a lot faster that way. I don't need to refresh the whole page. I just grab a small markdown file, render it with libraries already loaded, and dump it into a div. There are also minor issues around a11y, and around web crawlers. Again, you just want to be a little bit careful. And if you're doing this for yourself, you probably don't care about a11y or web crawlers.
- tomcam 6y agoOK that was a world class education in 3 paragraphs! Making my own Markdown-based CMS so this was gold. Thanks tons.