Live data from Hacker News

Why You Should Write Your Own Static Site Generator

arne.me

31–40 of 136 posts

Re: Why You Should Write Your Own Static Site Generator

#31
post #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…

> I'm certainly guilty of writing a few myself.

So am I. My first one was written in C in 1995, and the resultant site run under NCSA Httpd. DIY-ing becomes tedious after several cycles, though.

On the other hand, my experience with generally available SSGs has been miserable. They keep breaking my site after a few upgrades. At this point, I am very close to just spinning up wordpress for a new site.

Re: Why You Should Write Your Own Static Site Generator

#32
I have experienced both sides. First, I've written my own generator in Python (about 300 lines) but the code was not exactly maintainable and adding features like tagging was hard. So, I looked around and picked up Hugo. While I don't like the template engine it was not too much work, to set it up and offered everything I wanted. But Hugo comes with braking changes all the times! Plus the Hugo developers don't know what semantic versioning is, so you have to figure out whether a new release works with your configuration or not.

Now I'm on the verge to write my own generator again (probably in Kotlin or in Rust), because I'm tired of Hugo's breaking changes and because I still don't like the ugly Go templates.

Re: Why You Should Write Your Own Static Site Generator

#35

> 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 hos…

This is presently how my website works. I'm no webdev so I'm probably committing all sorts of heresies, though. I use m4 macros to build the header/footer structure with links and coloring and whatnot. Then the content pages are emacs Org files I publish to HTML and include with the m4 macros. You can do a surprisingly large amount with Org Export.

Re: Why You Should Write Your Own Static Site Generator

#36
post #27

Did an SSG last month. I had used pelican before; but I wanted to get a better handle on using Markdown and Jinja libraries "from the other side" as well. I would have needed to adapt my file structure or write some code to let pelican scan my idiosyncratic hierarchy to generate the posts. Turns out Markdown is easier to use on your own scripts, than it is to tweak its configuration in pelican; and Jinja is quite sim…

I know people write SSGs because of frustration with their existing one, but did you consider writing a tool that "publishes" to Pelican? That's kind of what I do: I write all my posts in a single org file, and have Emacs process them and output rst files for Pelican's consumption.

I did consider that; but I had other nebulous project ideas that benefit from getting better hold of Jinja, especially. Those ideas have grown considerably now, I'm glad I did my SSG, its given me more confidence in those notions.

Re: Why You Should Write Your Own Static Site Generator

#38

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 shi…

> 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.

Alternately, for many, there's more value to themself and everyone else if they grind on those technical skills rather than distract themselves with a hobby they seem inclined to put off.

If you really want to write, you'll write. If you really want to hack, you'll hack.

A lot of people think they should write, but actually just want to hack. And that's not a problem! The image of writing provides some orientation to the hacking, but it's the hacking itself that can be most fun and enriching for them.

Do the hacking, and if you never get around to the writing, don't sweat it. If you're honest with yourself: it was never really about that, was it?

Re: Why You Should Write Your Own Static Site Generator

#39

I've been very impressed with Eleventy: https://www.11ty.dev/ I find my lingering desire to roll out an SSG slowly fading.

Hadn't heard of Eleventy, I thought Zola was where you went for speed, which they don't even bother comparing too.

Found this post comparing them & more, Eleventy (man that's annoying to type on mobile with autocorrect though!) for speed it says. https://mtm.dev/static

Re: Why You Should Write Your Own Static Site Generator

#40
I too had build my own static site generator. A buddy asked if he could use it to build some sites, so I invested in it being more polished. Put a REST API in front of the engine and file management, and then an AJAX SPA on top of the API. Over the years, it's been used by a bunch of web sites - large and small. The largest was Longwood Gardens - which had hundreds of pages.

This was about 20 years ago now. Once it a while I consider refactoring/resurrecting it. But I've not found the time.

Post reply on HN