Conditional Page Bundles Based on Build Vars?

I have a site that should be 90% the same for multiple minisites.
I think I could handle most things with conditional page bundles where, say, the Introduction section is the only different thing between multiple sites.

It would be nice to have the same thing for text within a page.

So if I generate the site with site=site1 I get a specific introduction page bundle and if I use site=site2 I get a different introduction page bundle.

I have search a lot and found multisites information - but this is not the same because I don’t want to replicate the 90% of the site that is the same across multiple sites.

You can pass parameters from the command line:

HUGO_PARAMS_SITE=site1 hugo 

Then in your templates:

{{ if eq site.Params.site "site1" }}
  ...
{{ else if eq site.Params.site "site2" }}
  ...
{{ else }}
  ...
{{ end }}
1 Like