How I learned to stop worrying and love Web 1.0
One of the things I've ranted about repeatedly in the past is how Google's web crawler basically wants the web to be a bunch of static HTML files in directories, as it was before javascript and Apache and all those other things made life complicated. Now, you can get Google to index dynamic web pages if they hydrate themselves fast but, just when I thought I had figured this all out, along come LLMs and they start consuming web pages entirely using curl. We're back to 1993.
So the question is, how do we deal with this without going mad?
And then it struck me—having spent the last ten years building insanely fast dynamic web pages prepopulated with metadata and data that could render once and be SEO friendly, I'd also built a system for hydrating static HTML with code that fires exactly once.
Basically, for each url create a simple web page with html content wrapped in a custom element, and a script tag…
…where the content is what you want the crawler / LLM to see, and you're done. No server-side rendering beyond the simplest HTML, your code executes once, on the client.
The only downside is you do need to render the HTML for each page, once, at some point (and you may also need to render thumbnails, sigh). But every other system out there requires this and so much more. At least this way you have absolutely control over the HTML that the crawler / LLM sees. The doc system just does this automatically and instantly, but a more complex system (like this blog) might need to be slightly cleverer (basically route the url to a highly cacheable function call that just renders the HTML and you're done).
It's actually simpler than my earlier prefetch architecture, which itself was simpler than any server-side rendering strategies I've seen.
I tested this approach in tosijs-3d since it has zero users so the stakes are low.
But, as I've been building more stuff it occurred to me I could completely replace the build and documentation systems for all my projects with a system that implements this new approach and eliminates a growing maintenance overhead at the same time. So the new documentation system is built into tosijs-ui (but it's tree-shaken out if you don't use it).
Anyway, this worked really well and the entire approach is now a reusable component of tosijs-ui and it's replaced the bespoke system used for tosijs.net as well. Again, just try view source on any page of any of these sites and see for yourself.
As a bonus it produces nicer urls, proper metadata for every page, hierarchical navigation, [even] faster load times, and pages will load and be fully navigable even with javascript disabled.