Skip to content

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

@plannigan

Description

@plannigan

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions