r/statichosting

Do you optimize static sites for slow connections or mostly just average mobile?

I’ve been paying more attention to how static sites feel on slower mobile connections, not just how they score on Lighthouse. Even with prebuilt html, large images, web fonts, and a few third-party scripts can still make the page feel slow. I’ve started being stricter with image sizes, font weights, and loading anything non-essential later.

For static sites, what do you usually optimize first when trying to make the site feel fast on weaker connections?

reddit.com
u/xxmaskx — 19 hours ago

how much should you build for the future

something ive been thinking about with smaller client projects is how much of the archi should account for things that might happen later. its tempting to leave room for future features, more traffic or additional content. but most of the sites i work on dont actually grow in the way i initially imagine. im starting to wonder if its better to build for what the project needs today and refactor when theres a real reason to, rather than constantly preparing for hypothetical problems. how would you approach that balance? appreciate your insights.

reddit.com
u/sourraine — 4 days ago

Static export did not save me from stale assets after deploy

Static export felt simple until the CDN served new HTML with the wrong generation of JavaScript.

That failure is awful because the build is green. The files exist. A clean browser works. Only users with an older cached asset set get a broken page.

I fixed this by giving every export a deployment ID. The build reads it from the deploy commit, then falls back to the local git SHA. Exported asset URLs carry that ID:

?dpl=<deployment-id>

I also added a build check that fails when the exported homepage has no deployment key.

The test I care about now is:

  1. Open release A.

  2. Deploy release B.

  3. Keep the A tab alive.

  4. Open B in a clean tab.

  5. Verify both tabs load only assets from their own release.

  6. Remove A only after old clients are gone.

Purging everything on deploy looks easy, but it turns old open tabs into random failures. Keeping every release forever is wasteful.

How many previous asset generations do you keep, and what tells you it is safe to delete one?

reddit.com
u/Wooden-Bicycle-6069 — 5 days ago

_route.json

Is anyone actually using _routes.json on cloudflare pages, or just relying on the default include everything behavior?

Digging through the docs and it lets you manually set include/exclude paths so pages functions only run on routes that actually need them instead of every request getting checked. Seems like it'd help with cold start stuff on function-heavy sites but I can't find much real world experience with it, mostly just the docs page.

Anyone actually hand write these and see it make a real difference, or is it one of those things that sounds good on paper but nobody bothers with in practice?

reddit.com
u/Standard_Scarcity_74 — 6 days ago

Anyone using View Transitions on static sites?

I’m thinking about adding smoother page transitions to a static site without turning it into an SPA. The view transitions api looks useful but I don’t want animations to make navigation feel slower or get in the way. For those using it, how are you handling prefers-reduced-motion and keeping transitions fast?

reddit.com
u/Pink_Sky_8102 — 6 days ago

Do static sites really need anything more than basic hosting?

I’ve been working with a few static sites lately and honestly, I’m starting to wonder if we overcomplicate hosting them. If a site is basically just HTML, CSS, JS, images, etc what’s the actual advantage of using a more feature-heavy hosting setup? For a simple portfolio, landing page, documentation site, or small business site, wouldn’t basic static hosting + a CDN be enough for most cases? Curious what everyone here thinks.

reddit.com
u/xxmaskx — 9 days ago

How do you decide which client requests are actually worth building?

ive noticed that one, if not the most difficult parts of some projects isnt figuring out how to build something but deciding whether it should be built at all. a client might ask for a feature that sounds useful but after thinking about how often it will actually be used, i sometimes wonder if the added complexity is justified. im getting more comfortable asking what problem a feature is solving before immediately trying to implement it. curious if other freelancers eventually developed a similar instinct, or if this is something you just learn project by project.

reddit.com
u/sourraine — 8 days ago

Showing different content based on visitor's local time, no backend, and I actually had a reason

Been working on a static page (on the side as a side project) that shows nearby pharmacies that are open. Someone checking at 2am should see 24hr pharmacy and poison control info, someone checking at 2pm just needs a normal list. Static HTML obviously has no idea what time it is for whoever's looking at it.

I thought about just adding a backend for this but the whole point of the page is that it needs to survive 3am traffic spikes during outages when people are panic searching for an open pharmacy. That's also exactly when a database or server is most likely to choke. Didn't want that risk, especially for this use case.

So instead I'm using a Cloudflare Worker that reads request.cf.timezone (it's just there, geolocation based, no JS needed) to get local hour and day, then picks between 3 pre-built static HTML chunks (day, night, weekend) and swaps it in with HTMLRewriter. Nothing gets rendered per request, the worker just picks which pre-built chunk to serve. Those chunks are cached as normal static files, so no database, no server, no sessions, just static files plus a tiny function that picks which file to show.

An annoying catch though is that cf.timezone is based on IP not the actual device clock, so VPN users get the wrong local time. Figured that was fine since the alternative (reading time via JS) breaks for people with JS off, which is a group I actually care about here.

If anyone's dealt with this kind of thing before, curious how you handled the caching side of it.

reddit.com
u/Standard_Scarcity_74 — 11 days ago

when do you stop adding tools to your webdev workflow?

the more sites i build the more tools seem to accumulate. a tool for deployment, another for analytics, another for forms, image optimization, monitoring etc etc. most of them are useful but sometimes i wonder if im actually making my workflow better or just creating more things to manage lool at what point do you decide that a tool isnt worth adding even if it solves small problem?

reddit.com
u/sourraine — 12 days ago

How do you optimize font loading on static sites without hurting UX?

I’ve been paying more attention to font loading lately because even on a fast static site, a bad font setup can still cause layout shifts or that noticeable flash when the page loads. I usually self-host fonts, preload the main weight, and try not to include more variants than I actually need. For static sites, what’s your preferred setup for balancing fast loading, minimal CLS, and avoiding FOIT/FOUT?

reddit.com
u/Pink_Sky_8102 — 13 days ago