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 the File objects to have the correct dest_path and url values in the on_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 in blog/posts/blog-support-just-landed/, which mismatches the destination URL.
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.Possible fix in #45.