Add Google Analytics Support and Improve SEO

Signed-off-by: Dominik Prodinger <prodinger.d@outlook.com>
This commit is contained in:
Dominik Prodinger 2018-10-03 09:07:19 +02:00
parent 18b32be0b1
commit 628e6dce5d
No known key found for this signature in database
GPG Key ID: 579FE90AF376722E
3 changed files with 15 additions and 10 deletions

View File

@ -4,6 +4,9 @@ description: "Minimal Jekyll theme for storytellers"
baseurl: "/tale"
url: "https://chesterhow.github.io"
# Google Analytics
google_analytics: UA—XXXXXXXX-X
# Author
author:
name: Chester How

6
_includes/analytics.html Normal file
View File

@ -0,0 +1,6 @@
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>

View File

@ -1,17 +1,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% if page.title == "Home" %}
<meta name="description" content="{{ site.description }}">
{% endif %}
<title>
{% if page.title == "Home" %}
{{ site.title }}
{% else %}
{{ page.title }} &middot; {{ site.title }}
{% endif %}
</title>
{% seo %}
<!-- CSS -->
<link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
@ -24,4 +15,9 @@
<!-- RSS -->
{% feed_meta %}
<!-- Google Analytics-->
{% if site.google_analytics and jekyll.environment == 'production' %}
{% include analytics.html %}
{% endif %}
</head>