backstage / mkdocs-monorepo-plugin

✚ Build multiple documentation folders in a single Mkdocs. Designed for large codebases.
https://backstage.github.io/mkdocs-monorepo-plugin/
Apache License 2.0
314 stars 75 forks source link

Include docs from outside main directory #80

Closed ajh123 closed 1 year ago

ajh123 commented 2 years ago

Lets say I have multiple mkdocs projects on multiple disks. How would I use monorepo to include them in one site. bit like this,

├───A
│   └───src
│       │   mkdocs.yml
│       │
│       └───docs
├───B
│   └───src
│       │   mkdocs.yml
│       │
│       └───docs
└───C
    └───monorepo
            mkdocs.yml

I the monorepo's yml file I have tried

nav:
  - C:
    - A: '!include A:/src/mkdocs.yml'
    - B: '!include B:/src/mkdocs.yml'

Obviously, both A and B are not in the monorepo root so I have this error

[mkdocs-monorepo] The mkdocs file A:\src\mkdocs.yml is outside of the current directory. Please move the file and try again.

I can't have them all in the same directory. Can we have a config option that allows out of directory includes? I cant use https://github.com/wilhelmer/mkdocs-multirepo because A, B and C are not publicly facing git repos.

whiskeysierra commented 2 years ago

At my work, we successfully applied both of the following solutions:

  1. Symlinks: Create symlinks within C that point to ../A and ../B respectively
  2. Nested checkouts: Instead of checking out repos in a flat structure, we check them out using this:

In fact we have a dedicated root repository whose only job is it to checkout all other repos and which contains the mkdocs with the global navigation. Added benefit: Our deployment pipeline for our docs is running when any of the nested sites has a new commit.

ajh123 commented 2 years ago

Thanks, I will try the symlinks later!