Deploying from a multisite Hugo project?

I’m using Hugo to create multiple sites from the same project. So, I’m trying to deploy each site as a seperate Netlify site but I can’t get it to deploy right. I keep getting build errors or a “Page not Found” error. I’ve been looking around and it seems like other people have tried to do this but I can’t seem to figure it out. My structure looks like this:

└── hugo-multisite-project/
    ├── assets
    ├── layouts
    ├── sites/
    │   ├── websiteA/
    │   │   ├── content
    │   │   ├── public
    │   │   ├── config.toml
    │   │   └── netlify.toml
    │   └── websiteB/
    │       ├── content
    │       ├── public
    │       ├── config.toml
    │       └── netlify.toml
    ├── static
    └── package.json

What’s the best way to accomplish what I’m trying to do? Also, is it best to treat each site as a separate Netlify site or is it possible to deploy them from the same Netlify site but with different domain names?

I’m not sure if I’ve completely understood what you’re trying to do. I think you’re basically trying to create 2 separate websites. So, I can suggest you to use branch deploys.

Basically keep your Hugo website as it is, just upload both of them to different branches of the same git repository. Then, if you use a custom domain, you’d get an address like <branchname>.domain.com, and if you don’t use a custom domain you’d get an address like <branchname>--sitename.netlify.app.

Actually, i think figured it out. I realized the netlify.toml i had in each site folder was unnecessary. I just needed one at the root of the project. Each site has a specific build command so I just set that in the Netlify UI when I create a new site.

1 Like