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
316 stars 74 forks source link

Links between monorepo packages? #25

Open NickHeiner opened 4 years ago

NickHeiner commented 4 years ago

The example shows how to create a site like:

main/
API v1/
API v2/

Is it possible to link between docs in API v1 and API v2?

prcr commented 3 years ago

Hello,

What I do is using relative links between the files in the different repositories. So, for example, if you have the following files:

main/index.md
API v1/index.md
API v2/index.md

This is how I would write a link to the API index files on main/index.md:

- [API v1](../API v1/index.md)
- [API v2](../API v2/index.md)

When you write the relative links like this, MkDocs is able to correctly link the generated files and also validates if the links are correct during the build.

whiskeysierra commented 3 years ago

How would this look like with docs directories?

jamesone commented 2 years ago

@whiskeysierra Did you find out a way to achieve this?

bih commented 8 months ago

Looks like #94 should resolve this :)

bocje commented 6 months ago

Considering a mono repo project, the only (current) way to fix this was to use the site_name to be able to link from one site to the other within a markdown file. if we have

project_a
|_mkdocs.yml
|_docs
    |_a_file.md

project_b
|_mkdocs.yml
|_docs
    |_b_file.md

where mkdocs.yml on both only have a site_name: My Project A Docs and site_name: My Project B Docs respectively (no nav)

from b_file.md I could do

[link to a file](/my-project-a-docs/a_file

I tried using relative markdown links across mkdocs projects, but this would only render locally (in markdown previewers), but it wouldn't by any means render the correct website. I could use regular markdown links within the same project.

The above "problem" is that I'm using the site link rather than the relative markdown path. Is this the expected outcome? For now I'll tell developers to disregard using relative links across projects and use the site_name instead, but is this the intended way moving forward?