All Projects → datarobot → mkdocs-redirects

datarobot / mkdocs-redirects

Licence: MIT license
Open source plugin for Mkdocs page redirects

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to mkdocs-redirects

mkdocs-print-site-plugin
MkDocs Plugin that adds an additional page that combines all pages, allowing easy exports to PDF and standalone HTML.
Stars: ✭ 38 (-57.78%)
Mutual labels:  mkdocs
Readthedocs.org
The source code that powers readthedocs.org
Stars: ✭ 6,802 (+7457.78%)
Mutual labels:  mkdocs
docs
Source for documentation site
Stars: ✭ 73 (-18.89%)
Mutual labels:  mkdocs
fosscord-docs
Docs for Fosscord
Stars: ✭ 23 (-74.44%)
Mutual labels:  mkdocs
mr-pdf
PDF generator of document website
Stars: ✭ 58 (-35.56%)
Mutual labels:  mkdocs
Actions Gh Pages
GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.
Stars: ✭ 2,576 (+2762.22%)
Mutual labels:  mkdocs
mkdocs-rtl
mkdocs rtl theme based on mkdocs-material
Stars: ✭ 22 (-75.56%)
Mutual labels:  mkdocs
markdown-fenced-code-tabs
Generates tabs for consecutive markdown code blocks
Stars: ✭ 46 (-48.89%)
Mutual labels:  mkdocs
lavalink-list
A list of free and available public lavalink. Feel free to make a pull request!
Stars: ✭ 43 (-52.22%)
Mutual labels:  mkdocs
mkdocs-rss-plugin
MkDocs plugin to generate a RSS feeds for created and updated pages, using git log and YAML frontmatter (page.meta).
Stars: ✭ 43 (-52.22%)
Mutual labels:  mkdocs
emlid-docs
Documentation for Emlid products
Stars: ✭ 62 (-31.11%)
Mutual labels:  mkdocs
mkdocs-markdownextradata-plugin
A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template
Stars: ✭ 48 (-46.67%)
Mutual labels:  mkdocs
Mkdocs
Project documentation with Markdown.
Stars: ✭ 13,346 (+14728.89%)
Mutual labels:  mkdocs
mkdocs-section-index
MkDocs plugin to allow clickable sections that lead to an index page
Stars: ✭ 36 (-60%)
Mutual labels:  mkdocs
mkdocs-drawio-exporter
Exports your Draw.io diagrams at build time for easier embedding into your documentation
Stars: ✭ 50 (-44.44%)
Mutual labels:  mkdocs
docs
📖 TomoChain documentation
Stars: ✭ 19 (-78.89%)
Mutual labels:  mkdocs
Wechat Admin
Wechat Management System
Stars: ✭ 1,716 (+1806.67%)
Mutual labels:  mkdocs
mkdocs-table-reader-plugin
MkDocs plugin that adds a {{ read_csv('table.csv') }} markdown tag to directly insert CSV files as a table into a page.
Stars: ✭ 60 (-33.33%)
Mutual labels:  mkdocs
navio2-docs
No description or website provided.
Stars: ✭ 36 (-60%)
Mutual labels:  mkdocs
dotfiles
My dotfiles
Stars: ✭ 22 (-75.56%)
Mutual labels:  mkdocs

mkdocs-redirects

Plugin for mkdocs to create page redirects (e.g. for moved/renamed pages).

Initially developed by DataRobot.

Installing

Note: This package requires MkDocs version 1.0.4 or higher.

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 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:

  • The key of each redirect is the original markdown doc (relative to the docs_dir path).
    • This plugin will handle the filename resolution during the 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 MkDocs
  • 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 build process. This should be set to what the markdown doc's filename is, not the final HTML file rendered by MkDocs
    • External URL (e.g. http://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.

Developing

Setup a virtualenv

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

Build

make build

Test

make test

Releasing

make release

It will prompt you for your PyPI user and password.

See:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].