Merge branch 'master' of git://github.com/kcgthb/mkdocs-material into kcgthb-master

This commit is contained in:
squidfunk 2018-12-28 15:01:21 +01:00
commit afd2787fea
2 changed files with 26 additions and 0 deletions

View File

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

View File

@ -20,4 +20,15 @@
IN THE SOFTWARE.
-->
{% if page.meta.redirect %}
<script>
// redirect anchors
var anchor = window.location.hash.substr(1);
location.href = '{{ page.meta.redirect }}' + (anchor?'#'+anchor:'');
</script>
<!-- no-js fallback -->
<meta http-equiv="refresh" content="0; url={{ page.meta.redirect }}">
<link rel="canonical" href="{{ page.meta.redirect }}">
<meta name="robots" content="noindex">
{% endif %}
{% extends "base.html" %}