mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
add support for redirects via metadata extension
This commit is contained in:
parent
fa8d490b16
commit
0c17ca3a52
@ -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
|
||||
|
||||
|
@ -20,4 +20,14 @@
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
{% if page.meta.redirect %}
|
||||
<script>
|
||||
location.href = '{{ page.meta.redirect }}')
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="0; url={{ page.meta.redirect }}"/>
|
||||
<link rel="canonical" href="{{ page.meta.redirect }} " />
|
||||
{% else %}
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user