Hacker News new | ask | show | jobs
by dom96 1520 days ago
> In a static html site there is only one index.html so all routes have the same meta tags unless you overwrite the index.html file using an edge worker.

I guess this is specifically for SPA static sites? I would expect a static html site to have different html files for each page, like blog/2020-09-09-title.html and that could then have its own metatags, so no need for this dynamic rewriting, unless I'm missing something.

1 comments

Correct. This is only for SPAs that use client side routing like react-router. React SPAs are quite common with startups in my experience.
Crawlers like Google's run JavaScript now though, so your example is outdated.
This isn't only for googlebot but Twitterbot, slackbot, facebookbot and [fill-in-blank]bot that fetch your page to generate a url preview in their app when links from your domain are shared.
If that's your concern it probably makes more sense to just be server-rendering at that point
My main concern is cost. Cloudflare workers are free.
So is Vercel