Skip to content

Commit f0bc255

Browse files
committed
Support google analytics
1 parent f61244f commit f0bc255

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

layouts/_default/baseof.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang="{{ .Site.LanguageCode }}">
3+
<head>
4+
{{ partial "meta.html" . }}
5+
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
6+
7+
<!-- Render theme css -->
8+
{{ partial "css.html" . }}
9+
10+
<!-- Render custom header -->
11+
{{ partial "head.html" . }}
12+
13+
<!-- Refer: https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/ -->
14+
{{ if .IsTranslated }}
15+
{{ range .Translations }}
16+
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .RelPermalink }}" title="{{ .Language.LanguageName }}" />
17+
{{ end }}
18+
{{ end }}
19+
{{ template "_internal/twitter_cards.html" . }}
20+
</head>
21+
<body>
22+
<!-- Preloader. Set to true for front-page fade-in animation -->
23+
{{ if (and .IsHome .Site.Params.fadeFrontPage) }}
24+
<div id="preloader"></div>
25+
{{ end }}
26+
27+
{{ block "navbar" . }}
28+
{{ partial "navbar.html" . }}
29+
{{ partial "navbar-clone.html" . }}
30+
{{ end }}
31+
32+
{{ block "main" . }}
33+
{{ end }}
34+
35+
<!-- Back To Top Button -->
36+
<div id="backtotop"><a href="#" id="backtotop-color"></a></div>
37+
38+
{{ if .Site.Params.footer }}
39+
{{ partial "footer.html" . }}
40+
{{ end }}
41+
42+
{{ partial "javascript.html" . }}
43+
{{ template "_internal/google_analytics_async.html" . }}
44+
45+
{{ partial "analytics.html" . }}
46+
</body>
47+
</html>

layouts/partials/meta.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{ template "_internal/google_analytics_async.html" . }}
2+
{{ if eq .Site.Params.openGraph true }}
3+
{{ template "_internal/opengraph.html" . }}
4+
{{ end }}
5+
<meta name="description" content="{{ if .Params.summary }}{{ .Params.summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Hardcoded description; the author should update :){{ end }}" />
6+
<meta charset="utf-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
8+
<meta http-equiv="x-ua-compatible" content="ie=edge">

0 commit comments

Comments
 (0)