Skip to content

Commit

Permalink
Point canonical url for all releases docs to /latest/<page>
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Oct 11, 2018
1 parent c1362a3 commit df08556
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}" />
<link rel="stylesheet" href="{{ "/assets/css/main.css" | prepend: site.baseurl }}">
<link rel="shortcut icon" href="{{ "/assets/images/favicon.png" | prepend: site.baseurl }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}" />

{% comment %}
To make all documentation pages, regardless of version, lead search traffic to the latest version,
we need to point all the pages under /releases/v*/ to their latest version
{% endcomment %}

{% assign url_parts = page.url | split: "/" %}

{%if page.url contains "/releases/v" %}
{% assign canonical_page_url = "/releases/latest/" | append: url_parts[3] %}
{% else %}
{% assign canonical_page_url = page.url | replace:'index.html','' %}
{% endif %}

<link rel="canonical" href="{{ canonical_page_url prepend: site.baseurl | prepend: site.url }}" />
<link href="https://fonts.googleapis.com/css?family=Karla:400,700" rel="stylesheet">
</head>

0 comments on commit df08556

Please sign in to comment.