Live data from Hacker News

Why You Should Write Your Own Static Site Generator

arne.me

41–50 of 136 posts

Re: Why You Should Write Your Own Static Site Generator

#42
I built one. I run a content website for a living so it was worth it. I wrote about why here: https://nicolasbouliane.com/projects/ursus

The short version: text files let you use powerful tools, not just the WYSIWYG editor supplied with your CMS. Navigating markdown files in Sublime Text is incredibly fast compared to clicking around in a PHP admin area. I can even write blog posts with Obsidian on my phone.

It also means a very simple, very fast server that runs forever without maintenance. You don't need much to serve static files.

Above all, it means source-controlled content and content branches. This is great for big changes that span multiple pages.

Re: Why You Should Write Your Own Static Site Generator

#43
post #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 exa…

How do you feel about this attempt at creating a better WordPress that we have been working on?

It uses Git and Markdown for easy deployments to your serverless CI/CD pipeline just as you described.

I'd love your feedback :)

https://github.com/elegantframework/elegant-cli

Re: Why You Should Write Your Own Static Site Generator

#44
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…

Exactly. So writing your own generator doesn't differ from using a simple tool. At some point also this solution might not be robust enough.

Surely you can learn a lot in the process, but how much time does it need?

It was probably the author's fault to select NextJs for it. Maybe something simpler like gohugo might have been better: the tool is just a binary file, that doesn't require extra dependencies.

Re: Why You Should Write Your Own Static Site Generator

#46
I feel there's something to be said about a static site with a simple PHP-based search function thrown in there. Perhaps it could have even the full site content pre-generated as a data structure in PHP, for keeping in memory. Could be just word->pageId mappings, if you want to keep it simple.

Re: Why You Should Write Your Own Static Site Generator

#48
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…

But if you write a static site generator, you can blog about it. And that can be the first and the last post of your blog.

If you don't write one, the chance is good, your blog would stay empty.

Re: Why You Should Write Your Own Static Site Generator

#49
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 agree. I also wrote two static site generators, two dynamic ones, and used a few prefabricated solutions.

Then I discovered that for my writing style, org-mode with embedded scripts and plotting code really just works. I don't have to think much and I can focus on just writing. That particular authoring/publishing tool never gets in the way of what I want to express.

So I ended up patching over parts of org-mode to make it my static site generator. Sometimes the best is somewhere in between the extremes.

Post reply on HN