Live data from Hacker News

Why You Should Write Your Own Static Site Generator

arne.me

11–20 of 136 posts

Re: Why You Should Write Your Own Static Site Generator

#13
post #4

I've never understood the point of these things. Just use a solid CMS and cache to s3 or Varnish. What's the big deal?

I prefer using markdown files in a repo and generating my website using a SSG, because I find managing plain text files and a simple CI/CD pipeline to deploy easier to manage. The tooling for writing is my editor of choice, deploy is a git push and I don’t have to run a server or long running process. I can also easily migrate to any type of hosting more easily. I can see someone who is more used to Wordpress for example finding your workflow easier. It really mostly comes down to personal preference and what tools you are used to.

Re: Why You Should Write Your Own Static Site Generator

#14
post #4

I've never understood the point of these things. Just use a solid CMS and cache to s3 or Varnish. What's the big deal?

I wrote my own one also. It's ~100 lines of Go, generates the raw html that I commit to Git and which CloudFlare Pages automatically then deploys from a sub-folder for me.

I don't need to set up S3, Varnish, a server, a database, making sure my server + cms is up to date. It costs me $0, it's on a cdn and it's lightning fast + no headache. What's not to like?

Re: Why You Should Write Your Own Static Site Generator

#15
> Plus, you get to choose your own stack. Want to write your content in AsciiDoc? No-one can stop you!

I wrote a static site generator once. I used a Makefile and m4 macros!

Yes, it's true: nobody could stop me. It's much more debatable whether the "you should" part applies. I was just trying to get some common header and footer HTML into all pages of a site and do it with tools that were already installed on the hosting provider's machine.

It worked. For some reason, the person who took over the site after me did not follow in my footsteps and keep using m4.

Re: Why You Should Write Your Own Static Site Generator

#16
post #2

A fun experiment I’m sure but it’s not a very convincing argument for writing your own generator. In the same way the author claims frameworks will change, so will the tools that power their custom solution and using a framework will take a fraction of the time to get going.

This isn't really all that true and is highly dependent on the stack you want. You can run Java from 1.1 on modern JREs. PHP from the early 2000s can still work. It all depends on what your stack looks like. If you're using the highly unstable "everything moves fast and constantly breaks" newer stuff, then sure. It's hard to see Python 3 breaking within the next 5-10 years, after how well the 2->3 changes were receiv…

I have a .net 2.0 app still running with installs that I haven't touched in over ten years.

Re: Why You Should Write Your Own Static Site Generator

#17
post #4

I've never understood the point of these things. Just use a solid CMS and cache to s3 or Varnish. What's the big deal?

Hosting a static site is simple and can even be done for free.

Even though you can make a CMS fast, with a static site you can forget about performance altogether.

Finally, it meshes very nicely with editing files in eg markdown locally, which for some people (like me who live in Neovim) is a much nicer experience than editing things in a webpage.

Re: Why You Should Write Your Own Static Site Generator

#18
post #4

I've never understood the point of these things. Just use a solid CMS and cache to s3 or Varnish. What's the big deal?

Cheap/free static hosting is plentiful, static sites don’t have packages I need to keep up to date to avoid vulnerabilities, and writing posts/pages in a format like Markdown makes them dead simple to migrate between systems. Additionally, using a service like Netlify or GitHub Pages affords flexibility — all I need is a git client, a text editor, and an internet connection that can manage to transmit a couple of kilobytes. Don’t even need a browser.

Aside from that, a CMS is overkill for something like a simple blog. I might consider one for a more complex site but for a blog there’s no need.

Re: Why You Should Write Your Own Static Site Generator

#19
It's a fun project to try out new tech, but you have to acknowledge that you're doing it for fun rather than any sort of necessary reason. It's like when you build a game engine and never get around to doing the hard part: building the game.

It's a procrastination time hole that mostly just distracts us from the harder, less concrete, less fun thing we supposedly set out to do in the first place. It keeps us from shipping real shit.

e.g. Quit dicking around with your SSG and write the damn blog post already. The hard part of writing something worth reading is not your tech stack.

Re: Why You Should Write Your Own Static Site Generator

#20
I'm not sure I'd advocate for writing a static site generator, although I'm certainly guilty of writing a few myself.

Instead I always encourage people who are trying to start blogging to do the writing first. Figure out a workflow that works for you - what time of day you prefer writing, what editor, do diagrams naturally come up in your thought stream, etc. It's way easier to get this workflow dialed in when you're doing things locally since the switching cost between solutions is that much lower.

Only when you know that you A) enjoy writing and B) have something worth sharing should you invest the time in translating your workflow to something that can deployed. That might mean writing your own SSG - that might mean just spinning up a wordpress blog.

Post reply on HN