What would be the best approach for sharing some posts/assets (but not all) for multiple sites with different themes? I’m not afraid to edit the themes and mess around, if necessary. So far I’ve came to this:
- [x] Multiple
config.toml files (with different output/public dir setting), one per website. Using
hugo --config <site.toml> when exporting.
- [x] Moving shared static files to extra separate folder and specifying it in both configs. (Didn’t test it yet, but should work based on what I read.)
- [ ] Separating shared posts. Not sure where to put them, and not sure how to tell both sites to use the posts. I would also prefer if I could specify different paths for each site, but I can handle that with alias if needed.
I’m using mainroad and navigator themes. Any guidance is appreciated.
I would look into the relatively new mounts feature – import content assets as Hugo Components into /content, /layout, /assets etc… Search the documentation – note that you don’t need to use the socalled Hugo Modules to mount folders and files into your project.
Thank you. This seems to be the correct path, but I have an issue. Adding:
source = "../shared/assets"
target = "static/assets"
seems to cause theme’s mounts to be applied after root’s files. I.e. if the theme has
themes/mainroad/static/img/avatar.png and I have
static/img/avatar.png, I still get the theme’s default instead of my override. Without the mount, the override works.
I couldn’t find anything in the documentation about how all this works, or how I could modify the mount ordering.
Not one of those paths matches the mount config above, making it impossible for me to guess.
OK; I think I can guess what’s happening. If you define a module mount for your project, you need to define all of them (including the defaults you use, e.g. /static).
Excellent, that did it! Thank you.
I’ve actually tried that before posting, but only on a subfolder and also tested it wrong. There were two issues caused by this and I tried to fix one but checked for the other.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.