mkdocs / mkdocs-redirects

Open source plugin for Mkdocs page redirects
MIT License
176 stars 25 forks source link

Redirects to README.md (as index.html) are broken since v1.0.2 #23

Closed oprypin closed 2 years ago

oprypin commented 3 years ago
cat >mkdocs.yml
site_name: test
use_directory_urls: false

theme:
  name: material

plugins:
  - redirects:
      redirect_maps:
        foo.md: foo/README.md
mkdir -p docs/foo
touch docs/foo/README.md
pip install -U mkdocs-redirects==1.0.2
mkdocs build
cat site/foo.html                        
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Redirecting...</title>
    <link rel="canonical" href="foo/README.html">
    <meta name="robots" content="noindex">
    <script>var anchor=window.location.hash.substr(1);location.href="foo/README.html"+(anchor?"#"+anchor:"")</script>
    <meta http-equiv="refresh" content="0; url=foo/README.html">
</head>
<body>
Redirecting...
</body>
</html>

In the above example you can see a problem: MkDocs doesn't produce a file "README.html"; instead it is "index.html", so the redirect is broken. Previously it worked well:

pip install -U mkdocs-redirects==1.0.1
mkdocs build
cat site/foo.html                        

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Redirecting...</title>
    <link rel="canonical" href="/foo/index.html">
    <meta name="robots" content="noindex">
    <script>var anchor=window.location.hash.substr(1);location.href="/foo/index.html"+(anchor?"#"+anchor:"")</script>
    <meta http-equiv="refresh" content="0; url=/foo/index.html">
</head>
<body>
Redirecting...
</body>
</html>

I believe this is a direct consequence of https://github.com/datarobot/mkdocs-redirects/pull/19 (cc @plannigan).

https://github.com/datarobot/mkdocs-redirects/pull/21 has no effect on it; v1.0.3 is still broken.

oprypin commented 2 years ago

This is still a really big issue.

@plannigan @burkestar Do you have any plans to continue maintenance of this package (i.e. merging the pending fixes and releasing them)? If not, would you be open to handing over maintenance? I'm the current maintainer of MkDocs itself, and I offer to maintain this package, including moving it to mkdocs organization if necessary.

plannigan commented 2 years ago

While I did contribute the code for the initial change (and a PR that should address this issue), I don't have write access on the repository. So I can't merge any PRs or release new versions of the library.

It does seem like a fork might be in order because the repository doesn't appear to be actively maintained. It took 4 months to get the initial change merged & a similar thing happening with this issue. @burkestar Would DataRobot be open to transferring ownership to the maintainers of MkDocs?

oprypin commented 2 years ago

Oops I considered so many times that I need to double-check who I'm @-ing but made the embarrassing mistake anyway.