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

BUG: Edit URI of !included mkdocs.yml not respected when building pages #45

Closed egnwd closed 2 years ago

egnwd commented 3 years ago

Expected Behaviour

When creating documentation with the monorepo plugin I expect to be able to include sub-documentation and have the edit link on the final page be correct.

Current Behavior

When I load a page generated from the sub-documentation the ✏️ Edit link is incorrect, taking me to a 404.

Steps to Reproduce

I've added a sample docs folder that reproduces this issue.

  1. Checkout to this branch
  2. cd __tests__/integration/fixtures/bug-include-path-edit-uri
  3. npx @techdocs/cli build
  4. Inspect the index.html and test/index.html generated in the site folder

The top level docs is correct, the edit url generated is: https://github.com/egnwd/mkdocs-monorepo-plugin/edit/bug-edit-uri/__tests__/integration/fixtures/bug-include-path-edit-uri/docs/index.md The sub-docs is incorrect, the edit url generated is: https://github.com/egnwd/mkdocs-monorepo-plugin/edit/bug-edit-uri/__tests__/integration/fixtures/bug-include-path-edit-uri/docs/test/index.md

Note the ending should be .../api/docs/index.md but is .../docs/test/index.md which is its location once the merger has aggregated the folders and named them after the site_name.

egnwd commented 3 years ago

Just seen that this is likely a duplicate of https://github.com/backstage/mkdocs-monorepo-plugin/issues/2, but I'll leave it open as I do believe this is a bug and not many details were added to the other issue - but happy to be told otherwise

marc0olo commented 3 years ago

@emmaindal I commented on #2. I really like this plugin but I need to be able to display the correct edit url for the submodules I have included.

I see you added the help wanted label. I haven't checked the code yet. could you shortly summarize what needs to be done to get this working? have you already had a look into the issue?

iamEAP commented 3 years ago

could you shortly summarize what needs to be done to get this working?

Hey @marc0olo! Appreciate your willingness to help out on this. Here's my understanding of how things work:

Given the above, it makes sense that sub-documentation gets a broken URL because the repo_url and edit_uri are fixed configs at the root mkdocs.yml. To work around this, we'll need to do a couple of things...

I would also highly recommend cherry-picking @egnwd's test fixture commit and adding a test case in test.bats in the integration tests folder.

Hope that's enough to get you started!

emmaindal commented 2 years ago

Based on the information @iamEAP has provided, is this issues something you would like to pick up? @marc0olo I've not looked into the problem myself yet but we will do, just wanted to check in with you first! If you want to work on it let us know and we can assign you to the issue.

marc0olo commented 2 years ago

hey @emmaindal, currently I don't have a plan to cover this. decided to go another route finally as we had more important stuff to focus on

emmaindal commented 2 years ago

Totally understand @marc0olo, we will pick this up in our team. Thank you!

camilaibs commented 2 years ago

Closed by https://github.com/backstage/mkdocs-monorepo-plugin/pull/74

G-man83 commented 1 year ago

Steps to Reproduce

I've added a sample docs folder that reproduces this issue.

1. Checkout to [this branch](https://github.com/egnwd/mkdocs-monorepo-plugin/tree/bug-edit-uri)

2. `cd __tests__/integration/fixtures/bug-include-path-edit-uri`

3. `npx @techdocs/cli build`

4. Inspect the `index.html` and `test/index.html` generated in the `site` folder

The top level docs is correct, the edit url generated is: https://github.com/egnwd/mkdocs-monorepo-plugin/edit/bug-edit-uri/__tests__/integration/fixtures/bug-include-path-edit-uri/docs/index.md The sub-docs is incorrect, the edit url generated is: https://github.com/egnwd/mkdocs-monorepo-plugin/edit/bug-edit-uri/__tests__/integration/fixtures/bug-include-path-edit-uri/docs/test/index.md

Note the ending should be .../api/docs/index.md but is .../docs/test/index.md which is its location once the merger has aggregated the folders and named them after the site_name.

I have followed the above repo steps and it is still generating the incorrect edit_uri (as above).

@iamEAP @camilaibs is it possible that this has regressed?

Note, the @techdocs/cli --version is 1.4.5