Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #50 from prodingerd/patch-1
Browse files Browse the repository at this point in the history
Add support for Google Analytics and SEO
  • Loading branch information
chesterhow committed Oct 7, 2018
2 parents 8a6912e + d1659d0 commit 5ba410e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

source "https://rubygems.org"
gemspec
gemspec
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,6 +27,7 @@ sass:
plugins:
- jekyll-feed
- jekyll-paginate
- jekyll-seo-tag
# - jemoji #Uncomment this to allow emoji in your post

# Permalinks
Expand Down
6 changes: 6 additions & 0 deletions _includes/analytics.html
Original file line number Diff line number Diff line change
@@ -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>
16 changes: 6 additions & 10 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -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 }}">
Expand All @@ -24,4 +15,9 @@

<!-- RSS -->
{% feed_meta %}

<!-- Google Analytics-->
{% if site.google_analytics and jekyll.environment == 'production' %}
{% include analytics.html %}
{% endif %}
</head>
1 change: 1 addition & 0 deletions tale.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "jekyll", "~> 3.6"
spec.add_runtime_dependency "jekyll-paginate", "~> 1.1"
spec.add_runtime_dependency "jekyll-feed", "~> 0.10.0"
spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.5.0"

spec.add_development_dependency "bundler", "~> 1.12"
spec.add_development_dependency "rake", "~> 10.0"
Expand Down

0 comments on commit 5ba410e

Please sign in to comment.