Live data from Hacker News

Why You Should Write Your Own Static Site Generator

arne.me

61–70 of 136 posts

Re: Why You Should Write Your Own Static Site Generator

#61

Maybe don't write a static site generator. Maybe just make a normal website made of individual HTML and other files that doesn't require any "generation" at all. Static site generators are supposed to be for getting away from complexity but most of the time they just shift the complexity away from being attackable. There's no requirement for websites to be generated either statically or dynamically. The best websites…

That's a great start, but the problem comes when you want to have a site menu and breadcrumbs and then you want to redesign it. No problem for 5 pages, but if you have even dozens you'll start wanting to do something more automated.

Re: Why You Should Write Your Own Static Site Generator

#63
post #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 w…

You don't have to update it either.

Re: Why You Should Write Your Own Static Site Generator

#64
post #61

Maybe don't write a static site generator. Maybe just make a normal website made of individual HTML and other files that doesn't require any "generation" at all. Static site generators are supposed to be for getting away from complexity but most of the time they just shift the complexity away from being attackable. There's no requirement for websites to be generated either statically or dynamically. The best websites…

That's a great start, but the problem comes when you want to have a site menu and breadcrumbs and then you want to redesign it. No problem for 5 pages, but if you have even dozens you'll start wanting to do something more automated.

Use nginx (or whatever) and use server side includes for templating footers/menus/etc. It's extremely simple with the lowest possible attack surface for it's expressive power/utility. SSI should have never faded from the web dev toolkit; especially since it's actually still there in every popular webserver. Just,

    

whatever stuff here...lorem ispum, etc...

etc etc

I use it extensively and it's great. You're still just working with .html files in folders.

Re: Why You Should Write Your Own Static Site Generator

#65
post #61

Maybe don't write a static site generator. Maybe just make a normal website made of individual HTML and other files that doesn't require any "generation" at all. Static site generators are supposed to be for getting away from complexity but most of the time they just shift the complexity away from being attackable. There's no requirement for websites to be generated either statically or dynamically. The best websites…

That's a great start, but the problem comes when you want to have a site menu and breadcrumbs and then you want to redesign it. No problem for 5 pages, but if you have even dozens you'll start wanting to do something more automated.

[deleted]

Re: Why You Should Write Your Own Static Site Generator

#67
post #25

I agree. I don't mean to say you should not share it. You constructed something good, you feel pride in your device, by all means share it with the world. However static site generation is one of those simple fun rewarding types of program to make. The programing is straight forward, the results are linear with the input, that is, there is not a huge amount of boiler plate you have to wade through to see anything. Ba…

These are all good arguments why somebody can write their own (unlike e.g. rolling your own crypto), but aren't convincing me at all as to why I should.

I've used a static site generator myself to host a blog, and I've been pretty happy with it, yet I've never felt the need to write one myself even for a single second.

Re: Why You Should Write Your Own Static Site Generator

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

[deleted]

Re: Why You Should Write Your Own Static Site Generator

#70

  I know what you're thinking and you're right, it's way more work than using something
  that already exists. But it's also so much more fun. You can do anything with this,
  and you don't need to read documentation or try to understand other people's architectural
  decisions—just start writing code!
Great argument for never writing your own SSG.

Back in the day we didn't have SSG's. We just wrote the html/js/css by hand, and then used the existing browser and web server features to keep it DRY. No frameworks, no generators, no complexity. It wasn't fancy (or pretty) but it was simple and it worked.

Post reply on HN