Use a macro for the canonical URL

This commit is contained in:
Oliver Davies 2018-10-06 10:10:18 +01:00
parent 26297489c2
commit cd29262224

View file

@ -1,3 +1,10 @@
{% macro canonicalUrl(site, page) -%}
{{ site.url }}
{{- page.url != '//' ? page.url }}
{%- endmacro %}
{% import _self as helpers %}
<!DOCTYPE html>
<html lang="en">
<head>
@ -6,6 +13,7 @@
<link href="/dist/css/app.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,900" rel="stylesheet">
<link rel="canonical" href="{{ helpers.canonicalUrl(page, site) }}"/>
</head>
<body class="text-black bg-grey-lightest font-sans text-sm sm:text-base">
<div id="app">