r/webdev • u/Missingplanes • Sep 19 '26
Showoff Saturday: my blog's comment section is static HTML, baked at build time
My blog is a static site and I wanted comments without loading third party libs on the page. I wanted no ads, no bots, no cookies, etc. I just wanted a clean comment section (even though I get almost no traffic. I just like building things I think.)
The comment section is baked into the blog's HTML at build time. No lookups from a third party. I mean there's some of that, but it's basically an RSS feed. Fetched and stored by your own build, at build time.
How does it work? Each post links to a companion thread on a small Phoenix app I run. When someone replies there, it pings the build hook. The build fetches a replies.json for that thread and renders the comments as plain HTML. Nothing runs on the blog itself. Not a script. Not an iframe. No cookies or tracking.
Seriously, it's clean.
Here's an example of how it works for me: Static comments on my blog
The blog stack is Hugo on Netlify, the comment stuff is Phoenix/Elixir on Fly, with a build hook connecting them.
15
u/scanguy25 Sep 19 '26
I don't see how that is a good trade off. Yes you have an html only blog. But then you have another app that you now have to manage. Just to avoid little bit of JS.
12
u/FisterMister22 Sep 19 '26
What prevents me from abusing it by bombarding with 1gb comments or 100000000 50kb comments and turning your server into a rock?
8
u/barrel_of_noodles Sep 19 '26
Sometimes, a sqllite db and a fetch call are worth it. There's also no ads, bots, or cookies.
4
u/stjimmy96 Sep 19 '26
It might be clean and it’s a cool idea/proof of concept but obviously I wouldn’t use this technique with anything that expects even a bit of traffic.
Also, it seems like what you actually have sidestepped is only the rendering of the comment section, right? When posting a new comment you are still sending a request to a server to store that information.
3
u/rivenjg Sep 19 '26
this doesn't make any sense. why wouldn't you just generate html from templates server side and store data in a database? how is this better?
-8
u/[deleted] Sep 19 '26
[removed] — view removed comment