Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Plugin for mkdocs
to create page redirects (e.g. for moved/renamed pages).
Initially developed by DataRobot.
Note: This package requires MkDocs version 1.0.4 or higher.
Install with pip:
pip install mkdocs-redirects
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 the plugins
setting 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:
docs_dir
path).
mkdocs build
process.
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 MkDocsdocs_dir
)
mkdocs build
process.
This should be set to what the markdown doc's filename is, not the final HTML file rendered by MkDocshttp://example.com
)During the mkdocs build
process, this plugin will create .html
files in site_dir
for each of the "old" file that redirects to the "new" path.
It will produce a warning if any problems are encountered or of the redirect target doesn't actually exist (useful if you have strict: true
set).
use_directory_urls
If you have use_directory_urls: true
set (which is the default), this plugin will modify the redirect targets to the directory URL, not the actual index.html
filename.
However, it will create the index.html
file for each target in the correct place so URL resolution works.
For example, a redirect map of 'old/dir/README.md': 'new/dir/README.md'
will result in an HTML file created at $site_dir/old/dir/index.html
which redirects to ../../new/dir/
.
Additionally, a redirect map of 'old/dir/doc_name.md': 'new/dir/doc_name.md'
will result in $site_dir/old/dir/doc_name/index.html
redirecting to ../../new/dir/doc_name/
.
This mimics the behavior of how MkDocs builds the site dir without this plugin.
Create a virtualenv using a method of your choice.
brew install pyenv pyenv-virtualenv
pyenv install 2.7.18
pyenv virtualenv 2.7.18 mkdocs-redirects
pyenv activate mkdocs-redirects
make build
make test
make release
It will prompt you for your PyPI user and password.
See:
FAQs
A MkDocs plugin for dynamic page redirects to prevent broken links.
We found that mkdocs-redirects demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.