Use macros

This commit is contained in:
Oliver Davies 2018-10-06 12:19:52 +01:00
parent 1ff244c6ca
commit 238b0e5aad
2 changed files with 18 additions and 8 deletions

View file

@ -1,13 +1,16 @@
{% macro htmlTitle(site, page) -%}
{% if page.title is defined and page.url != '//' %}
{{ page.title }} |
{% endif %}
{{ site.title }} - {{ site.subtitle }}
{%- endmacro %}
{% import _self as helpers %}
<!DOCTYPE html>
<html class="no-js text-sm" lang="en-GB">
<head>
<title>
{% if page.title is defined and page.url != '//' %}
{{ page.title }} |
{% endif %}
{{ site.title }} - {{ site.subtitle }}
</title>
<title>{{ helpers.htmlTitle(site, page) }}</title>
{% include 'meta' %}
<link rel="stylesheet" href="/dist/css/app.css">

View file

@ -1,7 +1,14 @@
{% macro canonicalUrl(site, page) -%}
{{ site.url }}
{{- page.url != '//' ? page.url }}
{%- endmacro %}
{% import _self as helpers %}
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="{{ site.url }}{{ page.url == '//' ? '' : page.url }}" />
<link rel="canonical" href="{{ helpers.canonicalUrl(site, page) }}">
{% if page.meta.description %}
<meta name="description" content="{{ page.meta.description|e('html') }}">