DEV Community

Cover image for Hugo vs. Gatsby.js
David Large for CloudCannon

Posted on • Originally published at cloudcannon.com

Hugo vs. Gatsby.js

With GatsbyConf a few months behind us, and the new-conference-on-the-block HugoConf approaching on the horizon, we are now — temporally, at least — between Gatsby.js and Hugo. Distinctly different in their approaches to static site generation and developer workflows, both are popular and well established static site generators, with large and active communities surrounding them.

But which should you choose? The answer might be easier than you think, and it all depends on whether you’re building a ‘reference’ project or something that relies on user interaction. (Or at the very least, it depends where on that spectrum between those two points your project might land.)

Gatsby.js and Hugo are both fully compatible with CloudCannon’s Git-based CMS, and while both will work perfectly well for small business sites and blogs, each has different strengths. Whether you’re creating a documentation site with thousands of individual pages, or a single-page application with plenty of user interaction, or something in between, we’ll help you find the right tool.

What is Gatsby.js?

Gatsby.js is a static site generator built with React; it uses React/JSX for templating and GraphQL for queries. It was the first SSG to really blur the lines between static and dynamic sites, allowing developers to hydrate their purely static sites with React components for dynamic interactions.

Gatsby.js is a developer-friendly SSG, with built-in features like code splitting, prefetching, routing and caching. Finally, Gatsby.js is well established, with an active community and a very healthy plugin ecosystem.

Sites made with Gatsby

What is Hugo?

Hugo is a static site generator built with Go (Golang), released in 2013 by Steve Francia and actively (since version 0.14) maintained by Bjørn Erik Pedersen.

Hugo is one of the world’s most popular open-source static site generators. Even when compared to SSGs with venture capital backing, Hugo stacks up remarkably well in terms of overall installs, live sites, and GitHub stars. With its amazing speed and flexibility, Hugo makes building websites fun again.

Hugo’s popular primarily for its build speeds, though its flexibility and modularity plays a huge role as well. It’s simple to install, thanks to a single cross-platform binary, and has built-in features like i18n, image optimization, sitemaps, menus, and feeds. Oh, and if you’d like to start your Hugo build with a themes, Hugo has you covered.

Sites made with Hugo

Comparing Hugo and Gatsby.js — at a glance

  Hugo Gatsby.js
First release 2013 2015
Built with Go JavaScript
Templating engine(s) Go JSX
Plugins Limited Yes — thousands!
GitHub stars 59k+ 53k+
Themes Yes — hundreds! Yes — hundreds!
Licence Apache-2.0 MIT
Installation requirements None — Hugo is a single binary Via npm
Build speeds Fastest Slower
Remote data Via getJSON or getCSV Via GraphQL
Multilingual and i18n Built-in Yes, via plugins
Shortcodes Yes Yes, via plugins
Easy WordPress / legacy converter Yes: gohugo.io/tools/migrations No, but  only slight configuration is required to use Gatsby with WordPress
Learning curve You’ll need to learn conventions around folder structure and layouts, but otherwise straightforward. There are some amazing tutorials available for Hugo beginners. Easy for those with JavaScript and React experience, but steep for absolute beginners.
Documentation gohugo.io gatsbyjs.com
Support communities Hugo Discourse is a full-service forum with many active users; HugoConf promises to link Hugo users. AskGatsbyJS on Twitter; Gatsby Discord for real-time chat with community and team members; GitHub Discussions for more involved questions.
Twitter accounts Hugo Twitter Gatsby Twitter, Gatsby Changelog
GitHub repos github.com/gohugoio/hugo github.com/gatsbyjs/gatsby
CloudCannon support Yes — you can get your Hugo or Gatsby.js sites editable in minutes with CloudCannon.

 

So which should I choose?

Choose Gatsby.js if your site will feature or rely on React components for dynamic content, or if you see yourself needing to use GraphQL queries. For a single-page application (SPA), Gatsby is hard to beat — if your users are navigating within a site, pages are re-rendered by JavaScript and don’t require an additional server request.

Choose Hugo if you’re building a site that doesn’t require dynamic content or interactions. If you’re working on large reference sites with hundreds or thousands of pages, or if you think your site will eventually grow to that size, Hugo’s fast builds will work in your favor. (Your content editors will thank you!)

While you’re likely to need a solid background in React (and therefore JavaScript) to use Gatsby effectively, the same isn’t true for Hugo and Go — beginners to both will likely find Hugo easier to pick up, despite Go’s vaunted complexity.

Choose either — or both — with CloudCannon

Whichever static site generator you choose for your next website project, CloudCannon CMS will support you and your content editors with two-way Git syncing for collaboration, branch/merge workflows for adding new content and features, top-tier hosting, and best of all, an intuitive visual editor interface.

If you’re looking for tutorials, find out more about working with Hugo for beginners, or how to make the most of Hugo and CloudCannon. You may also find it helpful to dig into our Documentation to answer your SSG-specific questions about how to work with CloudCannon and Hugo, Gatsby,js, or any other static site generator.

Top comments (6)

Collapse
 
charliesay profile image
Charlie Say

I guess it’s all down to personal taste!

I got hooked on Gatsby years ago after watching Wes Bos do a few things on it, and now if i ever need a simple static website - i just go to gatsby as it’s super quick and familiar

But I’ve heard Hugo really competes, but all preference hey 🤷‍♂️

Collapse
 
avidlarge profile image
David Large

Absolutely — either personal taste, use case, or whichever way your experience skews; the answer is usually "it depends", right? I've found both work really well for simple static sites.

Collapse
 
pauliescanlon profile image
Paul Scanlon

Hey! Great post. Here’s some of Gatsby’s latest features. We’ve just launched Script Component which makes managing third-party scripts, off loaded to web workers, using Partytown a breeze.

gatsbyjs.com/blog/launch-week-the-...

Collapse
 
avidlarge profile image
David Large

Thanks! Script Component looks great; I'll look forward to digging into it.

Collapse
 
mmuller88 profile image
Martin Muller 🇩🇪🇧🇷🇵🇹

Thanks a lot this post is super informativ. Yeah many yers back I was choosing GatsBy because I eventuelly wanted to use components :). And I am about to use them. Cool post!

Collapse
 
avidlarge profile image
David Large

Thanks! I'll be interested to hear how you get on with it!