I would like to have the Hugo site live under “bjtnoguera.netlify.app”, and the Docusaurus site live under “bjtnoguera.netlify.app/notes/”, but I’m having issues getting that to work locally, and most importantly getting it to work on Netlify. Does anyone know how (or if) I can achieve this? Thank you for your time!
I’d recommend adding notes as a separate site as that’s a much easier setup, especially in your situation (as you mention you’re very new). You can always change once you learn more. But if you’re keen to do it, this is how you can (assuming you wish to build both sites on Netlify and not locally):
Put both sites in a single repo - you can separate using folders like hugo and docusaurus.
On Netlify, set the settings like:
– Base directory: ./
– Command: mkdir -p ./dist/ && mkdir -p ./dist/notes/ && cd ./hugo/ && npm i && hugo && cp -r ./public/ ../dist/ && cd ../docusaurus/ && npm i && npm run build && cp -r ./<docusaurus dist directory> ../dist/notes/
– Publish directory: ./dist/
Make sure to replace the directory in which Docusaurus will export the site. In Docusaurus, set the base path to /notes/. This is not the most optimal setup, but it could work.
Another alternative is to use Netlify Rewrites. You can setup both the sites as 2 different websites and in your Hugo site, add the following netlify.toml:
[[redirects]]
force = true
from = "/notes/*"
status = 200
to = "https://<docusaurus-site>.netlify.app/:splat"
You’d still have to set the base path in the Docusaurus website.
Thanks to your help, I have achieved the result I wanted, and now both of the sites live under https://bjtnoguera.netlify.app/ and https://bjtnoguera.netlify.app/notes