Skip to content

Commit f17a2ee

Browse files
authored
Merge pull request #66 from pages-themes/head-custom
Add head-custom.html to allow easier customization of the <head>
2 parents 6ed8ed0 + 305d7d6 commit f17a2ee

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% if site.google_analytics %}
2+
<script>
3+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
5+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
6+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
7+
ga('create', '{{ site.google_analytics }}', 'auto');
8+
ga('send', 'pageview');
9+
</script>
10+
{% endif %}

_includes/head-custom.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- start custom head snippets, customize with your own _includes/head-custom.html file -->
2+
3+
<!-- Setup Google Analytics -->
4+
{% include head-custom-google-analytics.html %}
5+
6+
<!-- You can set your favicon here -->
7+
<!-- link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.ico' | relative_url }}" -->
8+
9+
<!-- end custom head snippets -->

_layouts/default.html

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<link rel="stylesheet" type="text/css" media="screen" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
99

1010
{% seo %}
11+
{% include head-custom.html %}
1112
</head>
1213

1314
<body>
@@ -47,16 +48,5 @@ <h2 id="project_tagline">{{ site.description | default: site.github.project_tagl
4748
<p>Published with <a href="https://pages.github.com">GitHub Pages</a></p>
4849
</footer>
4950
</div>
50-
51-
{% if site.google_analytics %}
52-
<script>
53-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
54-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
55-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
56-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
57-
ga('create', '{{ site.google_analytics }}', 'auto');
58-
ga('send', 'pageview');
59-
</script>
60-
{% endif %}
6151
</body>
6252
</html>

0 commit comments

Comments
 (0)