Use modules to share content folder between sites

Hi all,
I have a few sites made with Hugo and wanted to know if it was possible for these sites to share content between them? So I have a few sites that have blogs and wanted one of my sites to post all blog entries from my all of my other sites.

I looked at Hugo mounts for that, but since I don’t use Github can Hugo modules work with local paths if the site folders are in the root of my web folder?

So I wanted to know if I can mount one site importing content folders from two sites.

I hope I made sense.

Yes, you can mount local paths. There are only a few restrictions:

  • Only the main project can use paths outside of the project directory (e.g. absolute paths) and symlinks.
  • For themes/theme components, the folders to mount must live relative to the theme root.

So, if you had this folder structure:

├── myblogcontent
├── site1
└── site2

You could do this in site1 and site2:

  source = '../myblogcontent'
  target = 'content/blog'

A footnote: Hugo Modules also support other Git providers (e.g. GitLab).


Thank you so much for your quick reply! I had no idea I could use local paths so will try that. Also noted what you mention regarding some restrictions. Thank you for the amazing work @bep

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.