Skip to content

Commit d6a5e16

Browse files
authored
Merge pull request #48 from pages-themes/head-custom
Add head-custom.html to allow easier customization of the <head>
2 parents 0a43ab3 + 1d09146 commit d6a5e16

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed
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

+9
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

+2-10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<![endif]-->
1313

1414
{% seo %}
15+
16+
{% include head-custom.html %}
1517
</head>
1618

1719
<body>
@@ -57,15 +59,5 @@ <h2>{{ site.description | default: site.github.project_tagline }}</h2>
5759
</div>
5860
</div>
5961

60-
{% if site.google_analytics %}
61-
<script>
62-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
63-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
64-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
65-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
66-
ga('create', '{{ site.google_analytics }}', 'auto');
67-
ga('send', 'pageview');
68-
</script>
69-
{% endif %}
7062
</body>
7163
</html>

0 commit comments

Comments
 (0)