Open gnaegi opened 2 years ago
More info on this: with the introduction of edit_uri.py
an incompatibility with the mkdocs-static-i18n
has been introduced. The problem is that the mkdocs-static-i18n
plugin generates pages for each languages starting with the language code (e.g. /en/yourmodule/yourpage/). The monorepo code in edit_uri.py
can not resolve this page uri because it does interpret the language code as a site which can not resolved as it does not exist on disk. Revolving the alias and the yaml page fail.
Simply put: monorepo is not compatible anymore with the i18n plugin.
As an ugly workaround I created empty fake sites for each languages that with the magic ''
trick don't appear in the navigation with an empty doc directory and an empty yaml file. What bothers me is that we do not use the edit_uri feature at all and the code that triggers the problem is only there to calculate the edit_uri
.
Example for our workarond: https://github.com/OpenOLAT/OpenOLAT-docs/blob/master/mkdocs.yml https://github.com/OpenOLAT/OpenOLAT-docs/blob/master/sites/de/mkdocs.yml https://github.com/OpenOLAT/OpenOLAT-docs/blob/master/sites/en/mkdocs.yml
Another solution would be highly appreciated: either check for the i18n plugin (e.g. config["plugins"]["i18n"]
or don't check for edit_uri
at all if not set in the main yaml file.
I have this error as well, except I am not using the i18n plugin. I'm using the https://github.com/wtc-cloud-eng/mkdocs-terraform-monorepo-plugin plugin which is built on top of this plugin.
Same error for me.
And I'm unsure how to work around it (no i18n plugin for me, either).
Backdating to version 1.0.0 seems to work.
This happens to me when I have a tree like this:
├── docs
│ └── ...
├── my-site-1
│ ├── docs -> ../docs
│ └── mkdocs.yml
├── my-site-2
│ ├── docs -> ../docs
│ └── mkdocs.yml
├── mkdocs.yml
and I run techdocs-cli generate --no-docker
or mkdocs build
from within my-site-1
or my-site-2
. Because the absolute path of the site-specific mkdocs.yml is not contained in the absolute real (resolved) path of the doc markdown files, the code makes it to here and then here but the url
is just ''
so splitting it fails.
Maybe having the above layout doesn't make sense for a user of this plugin. However, I am an accidental user of this plugin, not an intentional one, because this comes baked into the backstage-core plugins. That being the case, it'd be nice for this plugin to work with my setup.
Hi
I just updated the monorepo plugin and the before working project now fails to serve/build. I could drill down the issue to the pull request #74 which added the
edit_uri.py
file.When I comment the call
set_edit_url(config, page, self)
in the fileplugin.py
on line 71 the project builds fine.The edit_uri is not set in my environment and even when setting it something it does not build. The problem seems to have a dependency to the mkdocs-static-i18n plugin that we also use. I don't know if the root cause of the problem is in th2 i18n plugin or in the mono repo plugin. The issue occured after updating the monorepo plugin.
It would be great if you could add some check to the code to skip the edit-url thing when there is no edit-url set to fix this for cases like mine. Below I attached the Treaceback to narrow the issue.
What do you think?
Thanks for your work and thoughts about this issue
Regards Florian