add support for redirects via metadata extension

This commit is contained in:
Kilian Cavalotti 2018-10-17 12:53:43 -07:00
parent fa8d490b16
commit 0c17ca3a52
2 changed files with 25 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,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 %}