Host hugo blog from subdirectory

Site name: https://ethicli.netlify.app/
Custom domain: https://ethicli.com

Goal: add a blog to website at ethicli.com/blog

I have an existing website written in html, css, javascript at ethicli.com. It is in a directory called Website in a monorepo on github. I would like to keep the rest of the website as it is while adding a hugo blog at ethicli.com/blog from the directory Website/blog. I have tried too many combinations of things for me to remember at this point.

Current build settings look like this:


Repo structure:

config.toml

Currently I’m getting a 404 which is a step up from before when the build was failing.

I would appreciate any and all help and am happy to provide more information. Thank you

PS: eventually I would like to add Netlify CMS

UPDATE:
I have updated build settings like so

The result is that the main part of the website is back up and running. Also, I get something from the hugo site, though obviously not what I want:

I think your publish directory should be Website/blog/public. By default Hugo writes to public folder relative to the config.toml. Instead, you could also set Website/blog/ as your base directory. But if you need Node Modules, your package.json will have to exist there.

The other option would be to move your config.toml to your base path and then, you could set it up something like: https://github.com/Hrishikesh-K/OpinionJS/blob/main/config.toml#L3 (basically change the path for your directories).

Finally, I’m not sure why you have the -s flag. Hugo would automatically read files relative to the path of config.toml, so adding that is not changing anything at the moment, I suppose. You then won’t even need the -d flag adding unnecessary confusion.

1 Like