Hugo MultiSite workflow?

It turns out that MultiSite works out of the Hugo box.

There were a few config settings I hadn’t paid attention to which already make Hugo MultiSite happen. I’m not sure this the best way to do it, so I’d love some feedback. But I have tested that this Hugo MultiSite workflow works…

  1. Create a top-level folder inside your local Hugo install. I’m calling mine “sites”.
  • Inside the “sites” folder, create a new folder for your new website (ie: “websiteA”)
  • Inside your website folder, create a config.toml file, “content” folder, and “publish” folder
  • Set your content directory in config.toml contentdir = "sites/websiteA/content"
  • Set your publish directory in config.toml publishdir = "sites/websiteA/public"
  • Add your content .md files to your new content folder (sites/websiteA/content/)
  • Tell Hugo which website to work with. Now when you run Hugo, you must tell it where your website config file is, like so… hugo --config="sites/websiteA/config.toml". In effect you’re telling Hugo which website to work with, but that’s only possible if the config file contains the correct details for that website.
  • Repeat Steps 2-6 to create any number of new websites, and be sure to use Step 7 so Hugo knows which website you want to work with

The folder structure is entirely flexible, so you can organise it however you want: just be sure to set “contentdir” and “publishdir” accordingly, and tell Hugo which website to work with. Having a top-level “config” folder with the different .toml config files stored there might be a better option for you, or if you want to keep your runtime keystrokes at a minimum, you can keep the .toml config files at the top-level (just as config.toml is by default) and name them accordingly (“websiteA.toml”, “websiteB.toml”, “websiteC.toml”, etc.) which allows you to run Hugo for any specific website a little quicker…

hugo --config="websiteA.toml" //Runs websiteA
hugo --config="websiteB.toml" //Runs websiteB
hugo --config="websiteC.toml" //Runs websiteC

Hugo is seriously insane, in all the best ways. Thanks @spf13 for giving it to us, and to @natefinch & all the contributors for making it better again. Thanks also to @michael_henderson for the hugo --config="" tip.

10 Likes