Skip to content

Commit 4a58edb

Browse files
committed
add google_analytics_id to default.html
1 parent 2e80bf3 commit 4a58edb

File tree

2 files changed

+98
-57
lines changed

2 files changed

+98
-57
lines changed

_layouts/default.html

Lines changed: 82 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en-us">
3+
{% include head.html %}
34

4-
{% include head.html %}
5+
<body>
6+
{% include sidebar.html %}
57

6-
<body>
7-
8-
{% include sidebar.html %}
9-
10-
<!-- Wrap is the content to shift when toggling the sidebar. We wrap the
8+
<!-- Wrap is the content to shift when toggling the sidebar. We wrap the
119
content to avoid any CSS collisions with our real content. -->
12-
<div class="wrap">
13-
<div class="masthead">
14-
<div class="container">
15-
<h3 class="masthead-title">
16-
<a href="{{ site.baseurl }}/" title="Home">{{ site.title }}</a>
17-
<small>{{ site.tagline }}</small>
18-
</h3>
19-
</div>
20-
</div>
10+
<div class="wrap">
11+
<div class="masthead">
12+
<div class="container">
13+
<h3 class="masthead-title">
14+
<a href="{{ site.baseurl }}/" title="Home"
15+
>{{ site.title }}</a
16+
>
17+
<small>{{ site.tagline }}</small>
18+
</h3>
19+
</div>
20+
</div>
2121

22-
<div class="container content">
23-
{{ content }}
24-
</div>
25-
</div>
22+
<div class="container content">{{ content }}</div>
23+
</div>
2624

27-
<label for="sidebar-checkbox" class="sidebar-toggle"></label>
25+
<label for="sidebar-checkbox" class="sidebar-toggle"></label>
2826

29-
<script src='{{ site.baseurl }}/public/js/script.js'></script>
30-
<script src="https://kit.fontawesome.com/00c52b79f4.js" crossorigin="anonymous"></script>
31-
<!-- <script type="text/x-mathjax-config">
27+
<script src="{{ site.baseurl }}/public/js/script.js"></script>
28+
<script
29+
src="https://kit.fontawesome.com/00c52b79f4.js"
30+
crossorigin="anonymous"
31+
></script>
32+
<!-- <script type="text/x-mathjax-config">
3233
MathJax.Hub.Config({
3334
tex2jax: {
3435
inlineMath: [['$','$'], ['\\(','\\)']],
@@ -39,22 +40,62 @@ <h3 class="masthead-title">
3940
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
4041
type="text/javascript">
4142
</script> -->
42-
<script type="text/javascript" async
43-
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-MML-AM_CHTML">
44-
</script>
43+
<script
44+
type="text/javascript"
45+
async
46+
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-MML-AM_CHTML"
47+
></script>
4548

46-
<script type="text/x-mathjax-config">
47-
MathJax.Hub.Config({
48-
extensions: ["tex2jax.js"],
49-
jax: ["input/TeX", "output/HTML-CSS"],
50-
tex2jax: {
51-
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
52-
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
53-
processEscapes: true
54-
},
55-
"HTML-CSS": { availableFonts: ["TeX"] }
56-
});
57-
</script>
58-
</body>
49+
<script type="text/x-mathjax-config">
50+
MathJax.Hub.Config({
51+
extensions: ["tex2jax.js"],
52+
jax: ["input/TeX", "output/HTML-CSS"],
53+
tex2jax: {
54+
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
55+
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
56+
processEscapes: true
57+
},
58+
"HTML-CSS": { availableFonts: ["TeX"] }
59+
});
60+
</script>
61+
{% if site.google_analytics_id %}
62+
<script>
63+
(function (i, s, o, g, r, a, m) {
64+
i["GoogleAnalyticsObject"] = r;
65+
((i[r] =
66+
i[r] ||
67+
function () {
68+
(i[r].q = i[r].q || []).push(arguments);
69+
}),
70+
(i[r].l = 1 * new Date()));
71+
((a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]));
72+
a.async = 1;
73+
a.src = g;
74+
m.parentNode.insertBefore(a, m);
75+
})(
76+
window,
77+
document,
78+
"script",
79+
"//www.google-analytics.com/analytics.js",
80+
"ga",
81+
);
82+
ga("create", "{{ site.google_analytics_id }}", "auto");
83+
ga("send", "pageview");
84+
</script>
85+
{% endif %}
86+
<!-- Google tag (gtag.js) -->
87+
<script
88+
async
89+
src="https://www.googletagmanager.com/gtag/js?id=G-Q2JJ83TDH3"
90+
></script>
91+
<script>
92+
window.dataLayer = window.dataLayer || [];
93+
function gtag() {
94+
dataLayer.push(arguments);
95+
}
96+
gtag("js", new Date());
5997

60-
</html>
98+
gtag("config", "G-Q2JJ83TDH3");
99+
</script>
100+
</body>
101+
</html>

_layouts/post.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
---
44

55
<div class="post">
6-
<h1 class="post-title">{{ page.title }}</h1>
7-
<span class="post-date">{{ page.date | date_to_string }}</span>
8-
{{ content }}
6+
<h1 class="post-title">{{ page.title }}</h1>
7+
<span class="post-date">{{ page.date | date_to_string }}</span>
8+
{{ content }}
99
</div>
1010

1111
{% if site.related_posts.size >= 1 %}
1212
<div class="related">
13-
<h2>Related posts</h2>
14-
<ul class="related-posts">
15-
{% for post in site.related_posts limit:3 %}
16-
<li>
17-
<h3>
18-
<a href="{{ site.baseurl }}{{ post.url }}">
19-
{{ post.title }}
20-
<small>{{ post.date | date_to_string }}</small>
21-
</a>
22-
</h3>
23-
</li>
24-
{% endfor %}
25-
</ul>
13+
<h2>Related posts</h2>
14+
<ul class="related-posts">
15+
{% for post in site.related_posts limit:3 %}
16+
<li>
17+
<h3>
18+
<a href="{{ site.baseurl }}{{ post.url }}">
19+
{{ post.title }}
20+
<small>{{ post.date | date_to_string }}</small>
21+
</a>
22+
</h3>
23+
</li>
24+
{% endfor %}
25+
</ul>
2626
</div>
2727
{% endif %}

0 commit comments

Comments
 (0)