News for hackers. Stuff that matters.
Re:Zola: A fast static site generator in a single binary by regus on Friday March 05, 2021 @10:35AM (#26357962)
I though this was about the wedding registry site at first.

Anyway, I liked this line from the Github:

> Hugo gets ehh for the template engine because while it is probably the most powerful template engine in the list (after Jinja2) it personally drives me insane, to the point of writing my own template engine and static site generator. Yes, this is a bit biased.

This seems to be the life cycle of static site generators (SSG). It works at first, but you end up wanting to design your own custom SSG once you run up against something that goes against your mental model of how things should work.

I did this exact thing when I got frustrated with Hugo. I made my own custom SSG in order to create my blog.

The other thing that tends to happen with SSGs is that it can be a lot more fun to play around with the tech than actually writing blog posts!

If you're interested you can read here to see how I made an SSG for my blog:

https://joelregus.com/posts/blog/index.html

Re:Zola: A fast static site generator in a single binary by spf13 on Friday March 05, 2021 @02:29PM (#26361006)
I did this exact thing when I got frustrated with Jekyll (and friends) and created Hugo. Of course, at the time all SSGs were in dynamic languages and very VERY slow.

Happy to see some Hugo ideas made it into Zola.

Re:Zola: A fast static site generator in a single binary by kcartlidge on Friday March 05, 2021 @04:47PM (#26362560)
I know the feeling. In my very meta case I get frustrated with my own SSGs, so every time I start learning a new language an SSG is one of my two standard projects to give a frame of comparison.

I now have my own SSGs written in C#, Go, Node, Python, Ruby, and PHP. It's totally ridiculous, I know. Yak shaving and shiny to the nth degree.

Re:Zola: A fast static site generator in a single binary by mbreese on Friday March 05, 2021 @04:57PM (#26362656)
That makes a lot of sense to me. It used to be that writing a blog engine was the "Hello World" of a new language or framework. So, it makes sense that a SSG would be a good non-trivial project to use to learn or understand the pros/cons of a language.
Re:Zola: A fast static site generator in a single binary by ci5er on Monday March 08, 2021 @11:52AM (#26387943)
I prefer ray-tracers (or other rendering or physics engines), maybe because I'm old or have nothing to blog about.
Re:Zola: A fast static site generator in a single binary by hanklazard on Friday March 05, 2021 @07:01PM (#26363889)
Sorry to pile on here, but THANKS for Hugo! It’s legitimately great and has helped me quickly and easily updated (with the help of netlify) set up a really useful set of online notes for myself. I truly appreciate your work.
Re:Zola: A fast static site generator in a single binary by waterside81 on Friday March 05, 2021 @02:39PM (#26361109)
Hey - thanks for making Hugo. We run our blog on it and I love it. Spitting out an AMP version and maintaing it side-by-side with our non-AMP version was a piece of cake.

Edit: noticed you make Cobra too! Damn - I owe you like 1000 man hours of saved work.

Re:Zola: A fast static site generator in a single binary by regus on Friday March 05, 2021 @02:54PM (#26361272)
spf13, thank you for your vim config, I have been using it for years!

In regards to Hugo, I enjoyed using it at first, I loved how fast it was, but I kept running into issues so I decided to make my own SSG.

Re:Zola: A fast static site generator in a single binary by dtihanyi on Friday March 05, 2021 @08:39PM (#26364438)
I absolutely love Hugo and as someone who was completely new to static site generators, it was the easiest to pick up and use in my opinion. Thanks!
Re:Zola: A fast static site generator in a single binary by baxtr on Friday March 05, 2021 @05:03PM (#26362721)
Hey there, I’m a happy Jekyll user. What frustrated you about it?
Re:Zola: A fast static site generator in a single binary by epalm on Friday March 05, 2021 @07:01PM (#26363885)
Jekyll lost me at “step one, install ruby”
Re:Zola: A fast static site generator in a single binary by 1f60c on Friday March 05, 2021 @09:28PM (#26364685)
When Jekyll was created, all Apple laptops shipped with Ruby, and Apple has (had?) a large share of the “developer/power user” market. That’s my theory, at least.
Re:Zola: A fast static site generator in a single binary by Dma54rhs on Saturday March 06, 2021 @07:17AM (#26366907)
Even shared hosting at the time came with ruby on rails support. Maybe it still does, but ruby was way more popular at the time in general.
Re:Zola: A fast static site generator in a single binary by ognarb on Friday March 05, 2021 @06:45PM (#26363756)
Thanks for making Hugo. Hugo is the only SSG I found with a good story regarding i18n.
Re:Zola: A fast static site generator in a single binary by Keats on Friday March 05, 2021 @01:10PM (#26359924)
> I though this was about the wedding registry site at first.

I didn't even know what a wedding registry was until after the rename. It is named after https://fr.wikipedia.org/wiki/%C3%89mile_Zola

> I did this exact thing when I got frustrated with Hugo. I made my own custom SSG in order to create my blog. > The other thing that tends to happen with SSGs is that it can be a lot more fun to play around with the tech than actually writing blog posts!

Exactly that. A great way to learn a language too.

Re:Zola: A fast static site generator in a single binary by minitoar on Friday March 05, 2021 @10:59AM (#26358265)
Perhaps we need a meta ssg. An ssgg if you will. Perhaps a dsl for specifying ssgs.
Re:Zola: A fast static site generator in a single binary by threatofrain on Friday March 05, 2021 @11:08AM (#26358370)
I guess Racket’s proposal of language oriented programming isn’t so kooky after all.
Re:Zola: A fast static site generator in a single binary by threepio on Friday March 05, 2021 @01:00PM (#26359829)
Pollen, written in Racket, is arguably a "dsl for specifying ssgs"

https://docs.racket-lang.org/pollen/

Re:Zola: A fast static site generator in a single binary by mdtusz on Friday March 05, 2021 @01:16PM (#26359988)
Pollen seems so incredibly cool and powerful, but every time I have tried to play around with it, I get distracted by small quirks and areas that I wish were documented more clearly, or in a more organized format.

My daydream is to make a _good_ technical documentation system with it that is usable by the everyman, but it's still just a bit too much of a stretch. Markdown + pandoc + LaTeX templates get close, but LaTeX templating is a nightmare, and markdown is far too limiting and lacks expressivity (without ad-hoc DSL's slapped on top).

If anyone has a good pollen tutorial or example repo, I'd _love_ to know of it.

Re:Zola: A fast static site generator in a single binary by threepio on Friday March 05, 2021 @01:24PM (#26360080)
This is a sample Pollen project, annotated by the author using Racket's literate-programming dialect.

https://docs.racket-lang.org/pollen-tfl/

Re:Zola: A fast static site generator in a single binary by pvorb on Friday March 05, 2021 @05:39PM (#26363149)
Don't mess around with Markdown and LaTeX for documentation. AsciiDoc is what you want.
Re:Zola: A fast static site generator in a single binary by rodolphoarruda on Friday March 05, 2021 @07:55PM (#26364228)
Your post changed my life. Thanks for sharing this about AsciiDoc. It's such a nice tool.
Re:Zola: A fast static site generator in a single binary by mynegation on Friday March 05, 2021 @11:20AM (#26358563)
I believe Metalsmith [1] is trying that approach

[1] https://metalsmith.io/

Re:Zola: A fast static site generator in a single binary by pinjasaur on Friday March 05, 2021 @12:50PM (#26359676)
Metalsmith is pretty slick. I like how _everything_ is a just a plugin/middleware in essentially a pipeline. I've used it to template/scaffold [1] out projects before and it worked reasonably well.

[1] https://github.com/Pinjasaur/project-scaffolder

Re:Zola: A fast static site generator in a single binary by yoz-y on Friday March 05, 2021 @03:09PM (#26361418)
As long as they all use the same content format (like markdown + preamble) it’s relatively easy to move from one to another. Transferring themes is a pain though.
Re:Zola: A fast static site generator in a single binary by pvorb on Friday March 05, 2021 @05:37PM (#26363133)
I think we are doing pretty well with increasing the number of SSGs even without a meta SSGG. But I guess there are still more blogs around than SSGs, so there's still potential for incrementing that counter.
Re:Zola: A fast static site generator in a single binary by StavrosK on Friday March 05, 2021 @03:07PM (#26361404)
SSGG*
Re:Zola: A fast static site generator in a single binary by irrational on Friday March 05, 2021 @04:21PM (#26362284)
Are we all thinking of the same xkcd comic at this point?
Re:Zola: A fast static site generator in a single binary by brundolf on Friday March 05, 2021 @12:51PM (#26359692)
The thing about an SSG is that it's so trivial to write your own (at least for the basic cases). And then you may well get more benefit after that point from retaining the ability to customize it than you would from having a generalized one that you need to wrestle toward your use-case

It's something that feels highly generic, and so programmers jump on the chance to genericize it, but may not actually be that useful to have as a thing you can grab off the shelf

Re:Zola: A fast static site generator in a single binary by bachmeier on Friday March 05, 2021 @10:46AM (#26358111)
The problem I see with using a SSG is that (a) it probably doesn't do what you want, combined with (b) it's designed to automate specific workflows rather than to make customization easy. There are obviously some cases for which someone else's automated workflow is useful. I'm not sure how often the tradeoff is worth it if you are proficient with a programming language that you can use to automate the workflow yourself.
Re:Zola: A fast static site generator in a single binary by CJefferson on Friday March 05, 2021 @11:58AM (#26359051)
Personally, all I want is a full proper programming language in my templating. Every templating language ends up being irritatingly limited, for me at least.
Re:Zola: A fast static site generator in a single binary by mikepurvis on Friday March 05, 2021 @12:06PM (#26359140)
I think that's the big divide in templating languages— whether or not you trust the template author. Zero trust is a template like Liquid which has some trivial scripting stuff, but nothing non-halting (written originally for Shopify, where storefront owners could completely customize their look & feel).

And total trust is PHP.

In the middle is the whole realm of somewhat-trusted, where the templates can embed varying degrees of executable script, but you are at pains to let users know that too much embedding is a bad practice, and that especially if they're "just a designer", they should work with someone from software team to implement a properly-encapsulated solution for whatever it is they want to do.

Re:Zola: A fast static site generator in a single binary by Yoofie on Friday March 05, 2021 @12:50PM (#26359669)
I use PHP for exactly this reason. I wrote my own single .exe binary (written in C++) that generates JSON files from markdown files + others. The JSON files are then turned into static files via PHP using whatever template I care to create.

I think people their life harder when they go out of their way to avoid using PHP when really it is suited towards these types of problems.

Re:Zola: A fast static site generator in a single binary by mikepurvis on Friday March 05, 2021 @01:31PM (#26360145)
I mean, it used to literally stand for Personal Home Page, so it sounds like you're using it for its original purpose.
Re:Zola: A fast static site generator in a single binary by wccrawford on Friday March 05, 2021 @09:09PM (#26364594)
It drives me nuts when people implement template languages on top of PHP. That was its purpose.
Re:Zola: A fast static site generator in a single binary by xfer on Friday March 05, 2021 @12:14PM (#26359233)
racket scribble might be of interest to you. https://docs.racket-lang.org/scribble/
Re:Zola: A fast static site generator in a single binary by lenkite on Saturday March 06, 2021 @07:15AM (#26366902)
Re:Zola: A fast static site generator in a single binary by akvadrako on Friday March 05, 2021 @01:13PM (#26359951)
Python has had mako for a long time, which does this.
Re:Zola: A fast static site generator in a single binary by ibraheemdev on Friday March 05, 2021 @12:13PM (#26359211)
JSX seems to fit that bill, and many other languages have a comparable library.
Re:Zola: A fast static site generator in a single binary by chrisweekly on Friday March 05, 2021 @12:46PM (#26359628)
JSX (or even MDX) might fit the bill!
Re:Zola: A fast static site generator in a single binary by dukeyukey on Friday March 05, 2021 @12:04PM (#26359120)
Careful, you might end up with PHP.
Re:Zola: A fast static site generator in a single binary by the_arun on Friday March 05, 2021 @11:30AM (#26358696)
We don't need to create one if we do not like Hugo. There are other SSGs like Hugo. Jekyll, Gatsby, etc., More here https://jamstack.org/generators/
Re:Zola: A fast static site generator in a single binary by chrisweekly on Friday March 05, 2021 @12:47PM (#26359641)
NextJS is (by far) the best of the bunch, because it isn't limited to SSG.
Re:Zola: A fast static site generator in a single binary by proyb2 on Friday March 05, 2021 @10:12PM (#26364865)
They are not the right comparison, but we get your point.
Re:Zola: A fast static site generator in a single binary by chrisweekly on Friday March 05, 2021 @10:30PM (#26364932)
Please explain how it's "not the right comparison".

The parent listed static site generators including Gatsby, Hugo, and Jekyll. I suggested NextJS is a superior option to those 3, because (among many other things) it supports "export" of a fully static, pre-rendered site, which puts it -- unambiguously! -- in the "JAMstack SSG tools" category. So I'm baffled by the downvotes, and your dismissal.

What am I missing? Thanks in advance!

PS Edit to add: NextJS is even listed, as the 1st result, in the parent's jamstack link!

Re:Zola: A fast static site generator in a single binary by aendruk on Saturday March 06, 2021 @12:49AM (#26365516)
Re:Zola: A fast static site generator in a single binary by chrisweekly on Saturday March 06, 2021 @08:08AM (#26367087)
Thanks, @aendruk -- ok, that issue is a legit reason for some people, in some cases, to prefer a dedicated SSG-only tool over NextJS. But it's not a reason to leave NextJS off the list altogether.
Re:Zola: A fast static site generator in a single binary by patrickmcnamara on Friday March 05, 2021 @10:58AM (#26358247)
I think I’m just going to write a HTTP server for my website in Go, download the entire website with wget and host that statically. At least that way I can have any feature I want.
Re:Zola: A fast static site generator in a single binary by vidarh on Friday March 05, 2021 @11:35AM (#26358771)
When I decided it wasn't worth keeping my personal site dynamic, I took my webapp and pulled out the core of it, and built a small little script that enumerated the possible urls and "requested them" from the old webapp and wrote them to files, turning the webapp into a static site generator.
Re:Zola: A fast static site generator in a single binary by patrickmcnamara on Friday March 05, 2021 @01:00PM (#26359821)
Yep, exactly. Wget can do this with the --recursive flag.
Re:Zola: A fast static site generator in a single binary by michaelbuckbee on Friday March 05, 2021 @12:22PM (#26359325)
There are legit services/plugins that do this with Wordpress for similar reasons.
Re:Zola: A fast static site generator in a single binary by NotPavlovsDog on Friday March 05, 2021 @04:37PM (#26362450)
I've been contemplating converting some legacy WP to static, but have not had the time to review available options.

With root access to the server / just good old wget, are there benefits to using the plugins/services? Which would you suggest? Would be grateful if you shared your experience.

Re:Zola: A fast static site generator in a single binary by egeozcan on Friday March 05, 2021 @11:32AM (#26358731)
Why not varnish then?
Re:Zola: A fast static site generator in a single binary by patrickmcnamara on Friday March 05, 2021 @01:09PM (#26359910)
Simply because a lot easier to host static files than it is to host a web server binary that has to be executed. I can just upload to GitHub Pages or AWS S3 and let them worry about the HTTP caching, TLS certs, upgrade to HTTP/3, etc.
Re:Zola: A fast static site generator in a single binary by valvar on Friday March 05, 2021 @04:30PM (#26362377)
Writing a blog post about how you enabled the writing of that blog post is the most fun part! I just happened to write my own today in a very similar vein [0]. I guess using webhooks to automatically deploy might be pretty obvious, but I didn't know how to do it until today.

[0] - https://vnord.net/post/hugo/

Re:Zola: A fast static site generator in a single binary by remexre on Friday March 05, 2021 @11:07AM (#26358361)
Yep, I got frustrated with Zola, ended up maintaining a couple patches, and eventually ended up writing my own (ad hoc, not generally usable) SSG...
Re:Zola: A fast static site generator in a single binary by southerntofu on Saturday March 06, 2021 @05:17AM (#26366475)
Hello, i'm curious about your patches. Do you believe they could be useful for other people? Would you be willing to help upstream them?

I'm happy you coded your own SSG, and if you're happy with it it's cool, but maybe your painpoints with zola are valid for other people as well and we could try to fix them for everyone :)

Re:Zola: A fast static site generator in a single binary by remexre on Sunday March 07, 2021 @03:00PM (#26379216)
Already tried; patch that lead to the fork was "not adding this feature," sadly.
Re:Zola: A fast static site generator in a single binary by Lammy on Friday March 05, 2021 @12:06PM (#26359132)
> It works at first, but you end up wanting to design your own custom SSG once you run up against something that goes against your mental model of how things should work.

There is a middle ground. I hit this point in Jekyll when I wanted Insanely Great image thumbnailing that no extant Jekyll plugin could provide, ended up writing my own tool to do that, but didn't want to duplicate the rest of Jekyll's functionality too. It's kiiinda hacky and I probably should propose the interface changes upstream if I keep doing this, but a very light monkey-patch lets my tool pretend to be a Jekyll::StaticFile that just happens to write out many separate files: https://github.com/okeeblow/DistorteD/blob/master/DistorteD-...

Re:Zola: A fast static site generator in a single binary by TeMPOraL on Friday March 05, 2021 @07:57PM (#26364234)
Yeah, I wrote two. And I think my next SSG will be a Makefile, because generating HTML is the easy part. The tough part is tracking dependencies and xrefs, which I also think are the tough part of any build system (SSGs themselves are a subset of build systems).

That, and coming up with a good design for the page.

Re:Zola: A fast static site generator in a single binary by hexanal on Saturday March 06, 2021 @09:20AM (#26367499)
I'm doing the same thing but I wonder if I should even write something about it, hehe

Seeing all those HN posts about new static website generators and then your post makes me think that the important thing here is the concept of it, rather than specific implementations. I kind of like the multitude of options because it tells me that there's demand for that stuff, and we're all trying to find the most elegant solutions.

As a webdev, I'm happy to admit I'm not a programmer. I just dump some data in HTML templates, sprinkle some CSS and JS, while trying to give devs, editors, and users the tools to manage/navigate a website without much pain and suffering.

Re:Zola: A fast static site generator in a single binary by jacques_chester on Friday March 05, 2021 @12:23PM (#26359346)
> The other thing that tends to happen with SSGs is that it can be a lot more fun to play around with the tech than actually writing blog posts!

This has been my experience also[0]. Instead of writing I wound up a side quest to see if I could get Project Mallard[1] to do what I wanted.

[0] https://twitter.com/jacques_chester/status/13440340126086184...

[1] http://projectmallard.org/

Re:Zola: A fast static site generator in a single binary by pembrook on Friday March 05, 2021 @01:27PM (#26360111)
> The other thing that tends to happen with SSGs is that it can be a lot more fun to play around with the tech than actually writing blog posts!

I wish I could remember the link, but there's a fantastic XKCD-style cartoon making fun of over-engineered static site generator blogging setups.

When you build a static site, basically there's a 99% chance your only blog post is going to be "How I rebuilt this blog in [insert] static site generator."

Re:Zola: A fast static site generator in a single binary by laurent123456 on Friday March 05, 2021 @11:02AM (#26358310)
Indeed I guess there are so many SSG because it's so easy to create one. In fact it might take as much time or even less to build one than it does to learn all the quirks and bugs of an existing one.
Re:Zola: A fast static site generator in a single binary by brainzap on Friday March 05, 2021 @12:40PM (#26359553)
I use hugo but a script that converts my folder based writing style to Hugo markdowns, before build
Re:Zola: A fast static site generator in a single binary by temp8964 on Friday March 05, 2021 @01:09PM (#26359919)
If you really want to focus on writing, why don't you just use WordPress? My feeling is that SSG is a toy to play with.

I had a SSG blog before. After stop using it for half year and came back, I found I had to relearn the whole thing to be able to make it work again. Add any function is a PITA. Totally wasting of time.

Re:Zola: A fast static site generator in a single binary by southerntofu on Saturday March 06, 2021 @05:40AM (#26366547)
> why don't you just use WordPress?

Making a Wordpress theme is more complex, and is full of footguns for security concerns. The fact that using a specific theme can open security issues server-side is worrying to me.

I want my server to serve files without having to worry about security vulnerabilities. That's why i use a SSG (zola).

Re:Zola: A fast static site generator in a single binary by bccdee on Friday March 05, 2021 @01:59PM (#26360573)
You have to relearn it if you want to create a new theme for it. If you want to focus on writing, you just put new markdown files inside the post folder.

Not to mention that wordpress isn't static, which makes hosting more complicated & expensive.

Re:Zola: A fast static site generator in a single binary by temp8964 on Friday March 05, 2021 @02:54PM (#26361270)
My two cents are blogging through static hosting is more complicated than wordpress on basic php hosting. I need the email hosting comes with the $3/month web hosting anyway.