Ask HN: What's a good static site generator to use for a blog in 2018?

60 points by artemis73 ↗ HN
Hello HN community,

I've been meaning to start blogging for a while now but I never got around to it. I do have some time this weekend and I thought I'll give it a whirl then.

I recently read about Hugo and I was wondering if it's good enough for me to start with? Has anyone used it? How has your experience been so far?

My posts will mainly focus on little programming tidbits that I learn while I'm working so yes, it will involve code snippets. Markdown support is a huge pro for me as well. I am aware of Jekyll as it's one of the biggest players in this segment but everyone's been complaining about its speed which is why I'm not leaning towards it.

If anyone's got some advice on what SSG I can use, fire away. If you can, highlight both the pros and cons so I can make an informed decision on this.

Thank you for your time! Cheers!

128 comments

[ 5.3 ms ] story [ 202 ms ] thread
Hugo seems quite popular these days, especially if you like Go https://github.com/gohugoio/hugo
Even if you don't like Go, Hugo is super-easy to install and get up and running.
Yep, already have it running locally and exploring what it's capable of!
Gatsby is worth taking a look at.
Gatsby seems to be pretty slick but sadly, I'm unfamiliar with React. I primarily work on Django these days. I certainly will give Gatsby once I give React a shot. It's on the list of things I want to learn. Thank you very much!
Hugo is pretty good. I've started using it for some project websites[1,2], though I don't use it for blogging. For my own website/blog, I wrote it from scratch using Flask[3].

[1]: https://rootlesscontaine.rs/ [2]: https://umo.ci/ [3]: https://www.cyphar.com/

You're using the base16 theme for the first one, correct? Looks nice. I liked the second one as well. What theme is that?

Also, you've mentioned in the sidebar that you've built it using Grav and Hugo. Would you mind explaining how you've used both? And why perhaps? Just curious because someone here suggested Grav over Hugo and you seem to be using both.

I could make one with Django (overkill, I know) as I primarily work with it but I don't have a VPS set up yet and I don't think I'm going to attempt to get one anytime soon. The main reason why I wanted a static site is to not deal with configuring and maintaining the server. Thank you!

> You're using the base16 theme for the first one, correct?

Yup.

> I liked the second one as well. What theme is that? [...] Also, you've mentioned in the sidebar that you've built it using Grav and Hugo.

The theme is a Grav theme, ported to Hugo[1] (hence the "made with Grav and Hugo" -- the actual site is made with just Hugo). The source for the site is [2]. And the source for my other sites are here[3,4].

[1]: https://github.com/matcornic/hugo-theme-learn [2]: https://github.com/openSUSE/umoci/tree/b9e256550d732c14beeab... [3]: https://github.com/cyphar/rootlesscontaine.rs [4]: https://github.com/cyphar/cyphar.com

That's awesome, thank you very much! Checking those links out now. How difficult is it to port a Grav theme over to Hugo?
This is likely to be an unpopular answer, but the best choice is probably WordPress. I just used it to generate a network of about 40 static sites because (1) it has literally thousands of beautiful, professionally-developed themes for free; (2) same goes for plugins; (3) it's easy to hack if need be; and (4) it probably has one of the easiest-to-use and most-complete content editors, capable of creating both pages and blog entries, upload media, cropping images, etc.; (5) it has a variety of static site generation plugins to choose from; and (6) I spent hours looking at hugo, pelican, etc. and realized that any minor qualm I had with any of these common solutions was more or less addressed by the large and robust community of WordPress developers and enthusiasts.

It's not a sexy answer, but it's practical. Just make sure you don't leave the WordPress site you use to generate static content open to the public.

What’s your recommended method to make WP static? Have any of the other plugins broken for you from making WP static?
its not static tho, which invalidates it from this list.

The fact that you mention it has a content-editor indicates you're not using it in a static fashion.

(Correction, I hadn't realised you could use it in a static way... I last touched WordPress back in the dark ages!)

The idea is to use WordPress as the generator: Not the generated site.
The output is static HTML files uploaded to S3, that makes it a static site generator in such a setup. That it has a dynamic component for the editing process only doesn't change that.
I also recommend Wordpress with HardyPress. You can use Wordpress to create content more elegantly than with static plain files, and you can use HardyPress to make the result a fully static site.

I've been running my own blogs / portfolio in the last decade on static sites, from now now I'm using this new combo. Why? With the advent of the headless CMS scene static site generators just lost their unique advantage to spitting out HTML files. And meantime they didn't advance at all on the content creation side.

Creating, managing and distributing content with a CMS is far easier than with a static site generator. And when the final output is the same the choice is obvious.

Disclaimer: I'm not affiliated with HardyPress nor Wordpress, however I do create themes for Wordpress.

Notes: In my profile the first link is a statically generated site, as well as the others in the About section. The second link is a Wordpress+HardyPress combo and you can check it live the amazing speed it offers.

Will check out HardyPress. Thanks! It might make things easier if I end up with WordPress. Wasn't aware of it :)
I was going to say the same thing, but I would go a step further and say why the heck would you want a static site for a blog in 2018? WordPress is fast, secure, and sooooo easy to use. I'm a professional web developer with 20 years experience and I still use WordPress for my personal blog because it's so simple it saves a ton of time and effort.

There's really no value in "static" websites, if by static you mean pure HTML and CSS. a 512MB server from vultr for $2.50/mo can host dozens of simultaneous visitors on a well-built WordPress site without any slowdown at all.

I'm not a huge fan of WordPress mainly because of the security issues like the others have mentioned.

I've used it a little over a year ago and found things rather unintuitive when it came to setting up plugins. Not sure if it's gotten any better though. But, if you say it's practical, I'll give it another look and see if suits my needs. Thank you!

The best choices currently I think are:

-- Ghost (expensive but dead simple to apply themes) or

-- Hugo + Netflify (for hosting and automatically publishing your site when you push to your repo) + Forestry.io (for a nice front end to edit your posts if you want to avoid the command line)

I care about Markdown plus MathJax support (for math notation) and both these options support that.

Do you know who Ghost's intended target audience is? Their pricing at $29 (monthly) for hosting a simple blog seems bizarre when a DO droplet with pre-configured Wordpress is $5 (lots of other simpler WP hosting services out there).

Edit: ok, pricing page says „For professional bloggers“

Our customers are predominantly businesses and professional users who are quite happy to pay for a fully managed service and automation to save themselves time and energy. It's exactly the same as how you can self-host WordPress or Discourse for $5 on DigitalOcean, or you can find managed services at Discourse.org and WPEngine.com for $29-$99

If you're a developer and you want to just DIY - then you can. If you'd rather just pay someone else to manage the entire thing for you - then you can.

Ghost seems to be a bit expensive for my taste. Especially if you weigh it in my currency (INR). I'll consider it once I have my VPS set up but I'm leaning towards Hugo for now. Netlify is amazing :D

Thank you for Forestry though! Didn't know about it. Will definitely come in handy when I can't get to my personal laptop.

(comment deleted)
Git and GitHub Pages: Simple to set up and use, supports Markdown and code snippets.

Other than that I've never really understood the appeal of static site generators for normal websites or blogs that don't have millions of monthly page views.

Tools like Hugo for many common use cases (like ordinary websites with ordinary scalability requirements) often come across as a solution desperately looking for a problem while at the same time creating a few new problems: Compared with dynamic website software like WordPress they can be difficult to set up and they tend to be more difficult to use, especially for non-technical users.

I hope 2018 here means cool and new solution that's different from previous ones in many ways - GatsbyJS
Yep! I'd love to give Gatsby a shot but I have no knowledge about React. Will try it out once I learn a thing or two about it. Nevertheless, thank you very much for your suggestion :)
I used Github Pages which are Jekyll sites hosted by Github, which is sufficient for my needs and has a wealth of online documentation.

If it's for blogging, you can also take a look at Blogger, half the programming & security blogs I follow are on it.

Pelican (python) and Hugo were the ones I looked at before I decided to write my own toy SSG (python) for the heck of it. If you’re looking for something simple that you can build on, with support for Markdown, Jinja2 and static pages, take a look at https://github.com/amithmathew/pyjello If somebody wants to contribute, I’m happy to accept pull requests.
Any particular reasons why you chose to do this? I'm just curious on what the shortcomings of both these SSGs are that was off-putting to you.

I'll check it out. Seems to be mature enough to give it a try. Thank you!

What counts as "good enough" is such a subjective thing. What works for you will be some function of your needs and technical proficiency. It seems as though you don't have any specific needs, so any of the popular SSGs will be good enough for you. Pick one written in a language you already know, or pick one in a language you would like to learn. Some of the first Ruby code I wrote was a Jekyll plugin that I crudely hacked together. It worked fine. Jekyll is fast enough. Otherwise, there are plenty to choose from[0].

[0]: https://www.staticgen.com/

You're right about the subjectivity. Mainly why I asked everyone about their opinions and experiences so that I could make a decision based on that.

I'm not familiar with Ruby at all as I primarily work on Django. Go has always been on my todo list so I'm mostly leaning towards that for now.

Thank you for the link! I can have a good look at all the available options :D

What is all the recent trend for static site generators about ? What happened non-static sites ?
Security is a lot easier to reason about on a static site. Especially if you're leaving the server security up to, say Amazon and hosting off of S3 or a CDN.
Was security a huge problem in Wordpress ? I work in the tech industry too, but never came across security as an issue. Or is it about the plugins bringing in the unreliability ?
I haven't looked at Wordpress in years, but it used to have a terrible reputation when it came to security. Hopefully they've improved.
Plugins. The plugins are a never ending stream of XSS, SQLi, and other vulnerabilities. I used to intern on a web security team at Mozilla that hunted down these kinds of things and the entire experience revealed how easy it was to compromise your entire site because of a single plugin. During my six months there, I think I discovered 30+ plugins with issues. Most developers were responsive but some ignored us and the issues were never fixed.
Event without plugins, when your self host your wordpress you'd have to keep up with the updates.

Only having to send a bunch of static files makes it really easy.

I've personally never used Wordpress, but when I look at my server logs, there are always loads of requests from bots trying to attack Wordpress vulnerabilities in particular.
People realized that many pages don't need to be dynamic (especially since native comments on blogs are pretty much dead), and hosting a static site is easier/cheaper than taking care of a dynamic one. Why keep up with patching your CMS or pay someone to do that if it's not necessary?
It's hardly a "recent" trend now.
Hugo is, IMHO, one of the best, most versatile options out there for an SSG. I've been using it since v0.15 (now at 0.37).

I use it for a simple, mostly text, blog (https://kar.ai).

I also use it for an image-heavy company site (https://www.stonelandinc.com).

I also use it for 20+ other sites for clients.

It's undergoing heavy development, so that may be a pro or con, depending.

e.g. Recently they added image processing [0]. This eliminates a python script I was using for the same purpose. It's much faster as well, which matters when regenerating ~1k images.

Down side, documentation & community is still catching up on the newer features.

0: https://gohugo.io/content-management/image-processing/

That's quite some praise there. Definitely reinforces the suggestions others have made as well. 20+ sites is a lot, wow :O

I do not think the blog is going to be too image heavy as I'd like to keep it simple for now but it's definitely a plus to have. Thank you! :)

You have been using it for a long time, right? Have you found any issues in the case when you previously successfully generated a site using an older version, but then install a newer version in a different machine, and you try to generate the site with the "old" source?

That unfortunately has happened to me with other static site generators (breaking changes between versions with no automatic way to resolve them or thorough documentation on the changes to make to the source).

Yes, a couple issues along the way.

Honestly, they were minor enough that I don't remember the specifics, and it didn't take me long to fix.

Since they're not at v1.0 yet, this is to be expected somewhat.

This might be an unpopular opinion, but really wouldn’t sweat all the details just yet. I’d just start with something simple, free and widely used just so you get into the rhythm of blogging. An existing service probably, Wordpress would even suffice - I use Posthaven but it’s $5/month. You can focus on getting the perfect backend later, but I’d focus on writing the posts themselves and getting into the rhythm of writing to a schedule. Many well-intentioned blogs fall into disuse long before they outgrow their tech stack.

After you’ve put a dozen or so posts together you’ll have a better feel for what your needs are and you can then migrate your posts to the new platform of your choice - you can even write a blog post about it :-)

Posthaven is interesting! I'll have a look at it once I'm a bit more serious about blogging. Either this or something like Ghost.

You're right though. From what I can tell, most of these alternatives seem to be interoperable and I can jump around easily if need be. I'll start with hugo and see where that leads me. And I'll blog about that as well :) Great idea :D Thank you!

I don’t know the right answer for you (probably depends on the language you know best or want to learn) but the “standard” is Jekyll in terms of maturity and acceptance.
Yeah, that's the thing. I primarily work on Django so Hugo or Pelican make sense to me. I did give Jekyll a whirl but I wasn't overly fond of it. I'll have to read through the docs and then decide if it's right for me. Thank you! :)
I use Hugo [0] as a static website generator. They have plenty of themes [1] to choose from. You can still adjust it with basic knowledge in HTML/CSS. Afterward you can chose where to host it. You can use Github Pages [2] for free or pay for a service like DigitalOcean (starting with 5€ a month which scales well) [3]. I wrote a technical cheatsheet [4] on how to setup your own website with these ingredients.

- [0] https://gohugo.io/

- [1] http://themes.gohugo.io/

- [2] https://pages.github.com/

- [3] https://www.digitalocean.com/

- [4] https://www.robinwieruch.de/own-website-in-five-days/

Thanks for the last link. It will surely be helpful :D Hugo seems to be the winner for now.
Not sure if `blogdown` is known among wider audience. `blogdown` is an R package to generate static websites based on R Markdown and Hugo. So it couples the ease of using R markdown and speed/simplicity of HuGO. https://github.com/rstudio/blogdown But I'm not sure if a non-programmer would be interested in this just for blogging.
I'm using Hakyll, simply because I want a bit more exposure to Haskell. I've used Jekyll and Hugo in the past. Jekyll has lots of support but is slow for large sites. Hugo was alright. Only used it for a small project.
Interesting! Will check it out. Thank you!
I'm very happy with using pelican for my blog:

https://startuplab.io/blog

It's very flexible, written in python, easy to customize, has plugins for any purpose. It supports markdown, latex, code snippets (with syntax highlighting). It's very simple to set up and you can use it for any purpose.

I've made a custom theme, configured it a bit, and served it with nginx on digital ocean(but you could also host it for free on github pages).

You can see the code and my custom theme here:

https://github.com/raymestalez/startuplab

----

Here's a few simple things I want to recommend, based on my experience:

- Immediately setup a mailchimp account and an RSS feed. Add a link in the header, and under each post (you can see how it works on my blog), you want to start build a list of followers right away.

- Ideally, write a short ebook or a guide to give people extra incentive to subscribe. The sooner you do this - the better. Here's a sexy landing page I've made for my blog to use as an example:

https://startuplab.io/free-guide

- Keep the design elegant and simple, nobody needs distracting sidebars or popups, avoid them unless absolutely necessary.

- Underneath my posts, I have 3 boxes recommending my other articles (or promoting my projects), it's a really neat way to keep people on your site.

- Don't forget to set up metadata and social images for good SEO and sharing. You can see how I did it in my template here:

https://github.com/raymestalez/startuplab/blob/master/themes...

- For a very simple commenting system I highly recommend isso:

https://posativ.org/isso/

It's really easy to setup and a pleasure to use. Although personally, I share my posts on HN/reddit, and have a link to the discussion thread automatically embedded in the post footer. That way you don't need any complex setup, and it's better for the exposure.

Thanks for the detailed reply, however I don't see any links to HN/Reddit in the footer or anywhere else on the mobile page of your blog posts?
Thank you so much! I'll keep these points in mind while settings things up. I almost forgot about commenting. isso will need a server component to do what it does and I'm planning on hosting it on something like github pages.

But then, I don't like Disqus myself. Can't imagine forcing someone else to use it. I'll think about it. Thanks for bringing this up and for everything as well!

Maybe you'd like to have a look at Talkyard's embedded comments: https://www.talkyard.io/blog-comments — it doesn't require a server, if you use the hosted version. It's also open source like Isso, no ads or tracking. (I'm developing it.)
I've personally been meaning to rebuild my personal site with Next.js: https://github.com/zeit/next.js/

Used it to build a few static sites at work and have quite enjoyed it as you get to use React.

I've never worked with React myself. I primarily work on Django right now and do very little frontend work. Although, I've been meaning to pick up React so I shall try this once I do. Thank you very much :)