Publish the same site with different themes for different destinations

I’m trying to do something that I can’t see examples of. I want effectively build two versions of my site with different themes and some different configuration options (i.e., certain pages excluded). One of the versions would be for people not logged in, and would have certain content from each page hidden, and the other theme would be radically different in presentation, and have all page elements displayed, and site index, etc., but only for logged-in users.

Is this possible with hugo?

After running, I’d like it to have two output folders:

/published_public
/published_private

That would have the same content with different themes.

How would I accomplish this?

I think this would need to be done with one config per site and then run hugo multiple times.

  • See All settings for setting the publishDir
  • For multiple config files there are at least two options, but i would probably create multiple environments and put the environment specific config inside e.g. config/public/hugo.toml and then run hugo -e public etc.

It is certainly doable. I am currently using two themes simultaneously, kept in sync via a submodule.

Thanks for the direction. I was able to make that work.

Is there a way to use metadata to hide certain pages from the public site? Ideally, if someone clicks a link that is tagged as private, it would have a message prompting them to log in.

I have some experience with Jekyll, but it’s markdown parser is wonky and I hate the whole Ruby ecosystem, so I wanted to give Hugo a try since I enjoy Go. I’m not afraid of writing Go code to do this, but if there is a simpler way within the system, I’d rather do it that way.