Importing of a Hugo site to another Hugo site

Hello. We are trying to make a scheme with one main site and another embedded site. We are trying to import it as a module. So, the main site has multiple languages. Embedded site has the same languages. They share same theme and they have conflicting layouts (e.g. _default/baseof.html). The main site also already has the directory for that embedded site.

The structure of main site is:

  • en
    • about
    • faq
    • embedded site
      • about embedded site
  • de
    • about
    • faq
    • embedded site
      • about embedded site
  • es
    • about
    • faq
    • embedded site
      • about embedded site

And our purpose is to expand it with the embedded site like:

  • en
    • about
    • faq
    • embedded site
      • about embedded site
      • release notes
        • page 1
        • page 2
      • posts
        • post 1
        • post 2
  • de
    • about
    • faq
    • embedded site
      • about embedded site
      • release notes
        • page 1
        • page 2
      • posts
        • post 1
        • post 2

So we need to inject the embedded site into the existing dir of the main site.
Problems are: conflicting layouts and the languages. Even if we remove layouts and the build is successful, the content of resulting public dir is looks like:

  • en
    • about
    • faq
    • embedded site
      • about embedded site
    • en
      • release notes
        • page 1
        • page 2
      • posts
        • post 1
        • post 2
    • de
      • release notes
        • page 1
        • page 2
      • posts
        • post 1
        • post 2
  • de
    • about
    • faq
    • embedded site
      • about embedded site

So, all languages of the embedded site are placed into the en language of the main site, but we need to place each language into lang/embedded site/ dirs of the main site.

We also had thoughts of importing embedded site as a static, but afaik it’s not the designed way of using Hugo. Please correct me if I’m wrong.
And is there any way of dealing with conflicting layouts?

Thanks.

If I understand it correctly, you have two independent site sources

and you want to have one call to hugo to build one merged site from source

  • they don’t share any cross references but the one pointing from main site to embedded site
  • should also be working when generated standalone

any specific reason why?

  • not just generate two sites and cross link
  • integrate the sources to have one site

That`s quite a complex setup with a hundred ways to die. but if you really want to go that way

The most important stuff with that is that:
you do not have any settings in each site config that differ (menu, language settings, theme params, pagination settings…)

If so, I could imagine it’s possible with a complex setup of

  • url handling (refs, permalinks)
  • mounts
  • special template lookup rules
  • adjustments to (assumed both sites) that handle things special when embedded or not
  • guess you might also adjustment parts of the global theme

I will be easier to do two builds and

  • merge the results in a post build step
  • generate the embedded site stuff to the main sites static or public folder