diff --git a/CHANGELOG b/CHANGELOG index 51893f203..d0a74d50e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +mkdocs-material-3.2.0 (2018-12-28) + + * Added support for redirects using metadata refresh + * Fixed #921: Load Google Analytics snippet asynchronously + mkdocs-material-3.1.0 (2018-11-17) * Added support for Progressive Web App Manifest diff --git a/docs/extensions/metadata.md b/docs/extensions/metadata.md index 1bf2205af..096240457 100644 --- a/docs/extensions/metadata.md +++ b/docs/extensions/metadata.md @@ -48,6 +48,21 @@ see on the current page when you scroll to the top. It's as simple as: ``` markdown hero: Metadata enables hero teaser texts ``` +### Redirects + +It's sometimes necessary to move documents around in the navigation tree and +redirect user from the old URL to the new one. The `redirect:` meta-tag allows +to create a redirection from the current document to the address specified in +the tag. + +For instance, if your document contains: + +``` markdown +redirect: /new/url + +``` +accessing that document's URL will automatically redirect to `/new/url`. + ### Linking sources diff --git a/material/base.html b/material/base.html index c43facd30..51473e150 100644 --- a/material/base.html +++ b/material/base.html @@ -14,7 +14,12 @@ {% elif config.site_description %} {% endif %} - {% if page.canonical_url %} + {% if page and page.meta and page.meta.redirect %} + + + + + {% elif page.canonical_url %} {% endif %} {% if page and page.meta and page.meta.author %} diff --git a/src/base.html b/src/base.html index e26546293..21e8781b6 100644 --- a/src/base.html +++ b/src/base.html @@ -47,8 +47,21 @@ {% endif %} + + {% if page and page.meta and page.meta.redirect %} + + + + + + + - {% if page.canonical_url %} + {% elif page.canonical_url %} {% endif %}