Create two versions of the site

I am using hugo to create the developer documentation for a project. I would like to have two version of the compiled site:

  1. One that shows everything.
  2. One that only shows the user relevant pages.

Is it possible to use a switch to generate the two versions?

If you could split your presentation layer (files that display the content) across multiple themes you could generate the output in two different directories from these two different themes.

This could work, just as writing a script to copy the entire project except the files that i don’t want to be shown to users. But I am looking for a more “clean” way to do this

Also not clean, but I would simply create two projects and link the content files from the user documentation into the content folder of the developer documentation with ln -s.


I was first thinking that it would be nice to have different switches (in a #def #undef manner) but you are right, it will just make everything way too complicated.
I’ll create two project and link the content (with the equivalent of ln -s for windows)

In my head*

  • You need to mark the content somehow, i.e. a page param: user_relevant
  • Add a environment flag to switch these in the where clause(s)
  • Add this config option / environment to the command line when building: env BUILDALL=true hugo


Here I add an environment var to Circle CI so I only add the GA code when deploying to the real site.