-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fixed redirects for computed destinations and URLs #45
Fixed redirects for computed destinations and URLs #45
Conversation
I'm not sure whether the failing tests are false positives or not, due to the changed input of the function. |
The fact that the tests only check Any thoughts on why Python 2.7 fails? |
This is a great implementation! |
Uuh Python 2.7 fails because it's forced to install MkDocs 1.0.4 and that was prior to this very old bugfix... And these failures are real with MkDocs 1.0.4 😬 |
Yeah, I'm not sure how to proceed here. Is Python 2.7 support still necessary? I'm not familiar enough with the ecosystem to judge. Could we issue a new release without Python 2.7 support, locking it into using the version before the merge? |
I think I'll drop it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have these style comments
So I indeed dropped Python 2.7. We're fine to merge this as is, just with the changes I suggested. Afterwards I'll apply my refactoring of tests: https://github.com/mkdocs/mkdocs-redirects/compare/bb2ee628e2c064bd7ebc7d72e4426fa114ae7e1a |
Co-authored-by: Oleh Prypin <[email protected]>
Co-authored-by: Oleh Prypin <[email protected]>
Co-authored-by: Oleh Prypin <[email protected]>
Co-authored-by: Oleh Prypin <[email protected]>
All good, thanks for looking at this! |
Fixes #46
When defining redirects for Material for MkDocs' new built-in blog plugin, I stumbled upon a problem where computed URLs are not taken into account. The blog plugin recursively enumerates all Markdown files in the folder
docs/blog/posts
and then rewrites theFile
objects to have the correctdest_path
andurl
values in theon_files
hook. This is done so MkDocs and other plugins know the correct destinations for all blog posts. The result looks like this:Now, when I map the old paths to the new
src_path
, the redirects plugin will ignore the computed,file.url
and compute the target URL by itself, resulting inblog/posts/blog-support-just-landed/
, which mismatches the destination URL.This PR fixes the problem by using the computed URL, so the following configuration is correct: