-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
relative url start with "../" in nav no longer works #2752
Comments
I just encountered the same issue. Surprised such a killer bug has not received any response |
I confirm that #2296 (released in 1.2) changed this behavior. The thing is, this usage was never supported and always showed warnings anyway:
In MkDocs nav, relative links are always assumed to be links to Markdown documents within the site. You can use this appoach instead: site_url: https://example.com/known/absolute/path/
nav:
- Sibling: '/known/absolute/some/dir/' I am not sure if this will be revisited. |
The reason why I'm using this relative URL approach is that I'm deploying the same document to different path of the server, like /docs/docA/ and /docs_testing/docA/, in order to check the appearance before deploying it to the public, and want to make links to /docs/docB/ and /docs_testing/docB/ with single '../docB/'. |
Oh wow, you're right! 😞 mkdocs/docs/user-guide/configuration.md Lines 195 to 206 in f725e22
|
Is there any fix or workaround planned for this? |
I also would like this behaviour restored. My use case is wanting to deploy effectively two linked sites under the same base URL. I want to do this so that each sub-site can have it's own navigation tabs, and to make a clear distinction between the two sub-sites by styling them with different colours and titles. I can achieve the sub-sites easily, by having |
Also being bit by the same bug. In my case I want to link in my nav to some sphinx docs that are built and available via a relative URL locally. Absolute paths are not an option and neither are URLs. |
OK. I intend to fix this - I have linked a pull request, it just doesn't have tests yet. |
When I tried to make a link to an external resource in
nav
section of mkdos.yml, using the following example, the actual output HTML omits "../" in the relative URL and I couldn't point to external resources out of mkdocs with relative URL.https://www.mkdocs.org/user-guide/configuration/#nav
The minimal mkdocs.yml to reproduce the problem is as follows:
When I compile it with empty docs/index.md file, the navigation section in site/index.html became as follows:
What I expect was that the link of "Parent" should point to "../"(= https://example.com/) and the link of Sibling should point to "../some/dir"(=https://example.com/some/dir/), which are outside of the generated doc.
I remember this way (Sibling case) worked in past, but when I recompiled the document with the latest mkdocs, it started emitting unexpected URL.
The text was updated successfully, but these errors were encountered: