3 ms·
I can tell it's Friday because it took until the section ID until I realized this was going to be about user comments on a website not <!-- HTML comments --> LO
by zamadatix 4y ago
I can tell it's Friday because it took until the section ID until I realized this was going to be about user comments on a website not <!-- HTML comments --> LOL.
If you've got Ruby listening for updates with a postgres database all tied into a content generator it's probably time to admit you don't have a static website anymore and just look for best practice ways to go about this (with a bit more security!).
- cirrus3 4y agoSame here... and I wouldn't call this a static page anymore if it runs JS on load, calls a HTTP endpoint which makes DB query which returns HTML that modifies the DOM.
- dylan604 4y agobut if you can host your site from an S3 bucket, would it not be called static? to me, static means no server side languages necessary to render the page. if your statically served JS can call a remote host to pull down some data that updates things client side, it's still considered static, from a hosting perspective.
- codeflo 4y agoWouldn’t that definition would apply to standard SPAs as well?
- dylan604 4y agoI guess it depends on perspective. What a host service that will charge you more money for a non-static site, a client-side JS app can still be considered static. We might also be blurring lines of static sites vs interactive sites. You can have a static site that does nothing but allows the user to scroll to view it. You can also have static sites that change and do things based on the user's input. Entire games have been made using client-side JS but is still served statically.
- zamadatix 4y agoIMO if a web user triggered event triggers a server side page regeneration they see when the page reloads what you have is more a dynamic site with caching not a static site. "It's a write-to-file-before-serving site" isn't really a meaningful distinguisher but "the site functions the same when you only have a copy of the website files" is.
- layer8 4y agoThe JS doesn’t trigger a DB query, it loads a static comments file previously generated by Ruby at the time the last comment was inserted or modified. It could be replaced by a server-side include.
- nigamanth 4y agoYep, it's not static because data in the DB is changing the file.
- layer8 4y agoI’d regenerate the complete HTML page server-side whenever a comment changes, instead of only regenerating the comments section, to obviate the secondary loading via JS.
- zamadatix 4y agoThere is some advantage in splitting it in that the page itself stays cached even as the comments change and the page doesn't need to wait for the comments to be transferred to start rendering. You could keep this advantage with <iframe> if you really wanted to avoid JS though. It's a shame html imports died, they were a bit more lightweight.
- marginalia_nu 4y agoWhich advantage is that?
- atoav 4y agoCached pages load faster?
- marginalia_nu 4y agoIf you're just slinging static HTML, there's really not that big of a difference, and if it's a frequently accessed resource where a difference might be expected to matter, it will be cached regardless.
- danielheath 4y agoHilariously enough, that's no longer true in many parts of the world; according to firefox telemetry, on-device storage is frequently much slower than the network.
- brennebeck 4y agoDo you happen to have a link for that? It seems pretty counterintuitive given the state of modern PC hardware.
- moritzwarhier 4y agoIt's saturday here now, I've slept plenty and I still interpreted the headline the same way. But the topic is plenty interesting too, I'm curious how far the SSG movement will take it.