A MkDocs plugin for dynamic page redirects to prevent broken links
Maintained. Last release 8 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install mkdocs-redirectsmkdocs-redirects
Plugin for mkdocs to create page redirects (e.g. for moved/renamed pages)
Initially developed by DataRobot.
Installing
Install with pip:
pip install mkdocs-redirects
Using
To use this plugin, specify your desired redirects in the plugin's redirect_maps setting in your mkdocs.yml:
plugins:
- redirects:
redirect_maps:
'old.md': 'new.md'
'old/file.md': 'new/file.md'
'some_file.md': 'http://external.url.com/foobar'
Note
Don't forget that specifying thepluginssetting will override the defaults if you didn't already have it set! See this page for more information.
The redirects map should take the form of a key/value pair:
- The key of each redirect is the original markdown doc (relative to the
docs_dirpath).- This plugin will handle the filename resolution during the
mkdocs buildprocess. This should be set to what the original markdown doc's filename was (or what it would be if it existed), not the final HTML file rendered by MkDocs
- This plugin will handle the filename resolution during the
- The value is the redirect target. This can take the following forms:
- Path of the markdown doc you wish to be redirected to (relative to
docs_dir)- This plugin will handle the filename resolution during the
mkdocs buildprocess. This should be set to what the markdown doc's filename is, not the final HTML file rendered by MkDocs
- This plugin will handle the filename resolution during the
- Path of the markdown doc you wish to be redirected to (relative to