3 ms·
> TL;DR it's my personal site and I'll do what I want with it. It's for fun. That's great and I hope you keep on doing that. That said I have a few comments on
by Dunedan 7y ago
> TL;DR it's my personal site and I'll do what I want with it. It's for fun.
That's great and I hope you keep on doing that. That said I have a few comments on your actual implementation.
> If you clone my blog[1] (with submodules) you should be able to host it exactly as-is from the repo.
Who would want to do that? Somebody interested in running your website is probably somebody also willing to install and run a build tool. And even if not, if it's just about consuming the contents of your website without visiting your website, the Markdown in your git repository is accessible enough.
> Second, I wanted user interactions within my site to be very fast[3].
> [3] https://anderspitman.net/13/64-ms/ https://anderspitman.net/13/64-ms/
A noble goal, however the initial load time from a cold browser session was consistently between 3s and 4s for me. Probably because you got hit by HN, but looking at the network tab reveals why a statically generated page would've been way faster: Instead of loading 19 resources, you could've simply loaded 3 (HTML, CSS + Favicon). That'd have been significantly smaller and faster.
> After the initial load, subsequent navigations are much faster (and consistent) than retrieving a new static HTML page.
As already mentioned your initial page load would've been significantly faster with a statically generated page. What you do is optimize for subsequent page loads at the cost of the initial page load. I can only speak from my own experience, but I also believe this is true for most of the HN crowd: I usually end up on websites like yours, because somebody links to a specific article on it. I then read such an article and close the website right afterware. It's very rare that I look around what other content is available on such a website. So I don't know how your usual website visitors behave, but I'd assume visitors which actually visit more than 3-4 articles on your page a probably relatively rare and for such a few pages the sum of loading times would be shorter than your premature optimization.
However if you want to optimize for subsequent page loads I suggest you do so without compromising your initial page load and completely without JavaScript by utilizing link prefetching [1] which is supported by all major browsers [2] except Safari.
[1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Link_prefetching_FAQ https://developer.mozilla.org/en-US/docs/Web/HTTP/Link_prefe...
[2]: https://en.wikipedia.org/wiki/Link_prefetching https://en.wikipedia.org/wiki/Link_prefetching
- anderspitman 7y ago>> If you clone my blog[1] (with submodules) you should be able to host it exactly as-is from the repo. > Who would want to do that? Future me. Actually just today in order to publish this post I had to re-learn how I had set up my dependencies, so I switched it to submodules so it won't be a problem again. > However if you want to optimize for subsequent page loads I suggest you do so without compromising your initial page load and completely without JavaScript by utilizing link prefetching [1] which is supported by all major browsers [2] except Safari. Believe me, I spent a torturous amount of time trying to achieve the same results with static HTML+prefetching/preloading. First off, Safari is a huge number of users. Plus you can't include HTML from HTML, so this requires a build step (though I've been experimenting with a new tool[0] for mitigating that somewhat). Also, this doesn't allow maintaining state between navigations. [0] https://github.com/anderspitman/tuplates https://github.com/anderspitman/tuplates
- egdod 7y agoStatic HTML publishing is a solved problem. Don’t reinvent the wheel. Don’t make me run random JS to display plaintext. Don’t justify said random JS with silly whizbang features that no one actually wants.
- deleted 7y ago[deleted]
- zzo38computer 7y agoIt has been fixed so that there is a work around now. At first it was just blank, but now there is a work around. So, you can use that.