Skip to content
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

Redirects to nested README.md/index.md with directory URLS #24

Open
plannigan opened this issue Aug 1, 2021 · 0 comments
Open

Redirects to nested README.md/index.md with directory URLS #24

plannigan opened this issue Aug 1, 2021 · 0 comments

Comments

@plannigan
Copy link
Contributor

plannigan commented Aug 1, 2021

I stumbled on this when looking into #23. The key difference is use_directory_urls is set to true in this case.

mkdocs.yml

site_name: test
use_directory_urls: true

theme:
  name: material

plugins:
  - redirects:
      redirect_maps:
        foo.md: foo/README.md

Note that with use_directory_urls enabled, the original markdown do is the same as the redirect target. This results in the redirect output file being generated on top of the file generated by mkdocs. It appears that the only productive thing the plugin can do in this situation is true raise an error.

This occurs in both v1.0.1 & v1.0.3. This occurs for when the redirect target is README.md or index.md.

Commands to reproduce:

mkdir -p docs/foo
touch docs/foo/README.md
pip install -U mkdocs-redirects==1.0.3
mkdocs build

site/foo/index.html

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Redirecting...</title>
    <link rel="canonical" href="./">
    <meta name="robots" content="noindex">
    <script>var anchor=window.location.hash.substr(1);location.href="./"+(anchor?"#"+anchor:"")</script>
    <meta http-equiv="refresh" content="0; url=./">
</head>
<body>
Redirecting...
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant