1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-23 23:21:00 +01:00

Moved redirect code into main template

This commit is contained in:
squidfunk 2018-12-28 15:09:11 +01:00
parent afd2787fea
commit 59ce603ed8
4 changed files with 25 additions and 13 deletions

View File

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

View File

@ -14,7 +14,12 @@
{% elif config.site_description %}
<meta name="description" content="{{ config.site_description }}">
{% endif %}
{% if page.canonical_url %}
{% if page and page.meta and page.meta.redirect %}
<script>var anchor=window.location.hash.substr(1);location.href="{{ page.meta.redirect }}"+(anchor?"#"+anchor:"")</script>
<meta http-equiv="refresh" content="0; url={{ page.meta.redirect }}">
<meta name="robots" content="noindex">
<link rel="canonical" href="{{ page.meta.redirect }}">
{% elif page.canonical_url %}
<link rel="canonical" href="{{ page.canonical_url }}">
{% endif %}
{% if page and page.meta and page.meta.author %}

View File

@ -47,8 +47,21 @@
<meta name="description" content="{{ config.site_description }}" />
{% endif %}
<!-- Redirect -->
{% if page and page.meta and page.meta.redirect %}
<script>
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 }}" />
<meta name="robots" content="noindex" />
<link rel="canonical" href="{{ page.meta.redirect }}" />
<!-- Canonical -->
{% if page.canonical_url %}
{% elif page.canonical_url %}
<link rel="canonical" href="{{ page.canonical_url }}" />
{% endif %}

View File

@ -20,15 +20,4 @@
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" %}