Modularize analytics and add extra headers (#26)
This commit is contained in:
parent
97395d876c
commit
97cc83914f
3 changed files with 11 additions and 1 deletions
|
@ -89,6 +89,12 @@ You can modify or add any svg icons in site's `layouts/partials/svg.html`
|
||||||
|
|
||||||
We only have built-in support for Disqus at the moment, if that doesn't fit your needs, you can just add html to site's `layouts/partials/comments.html`
|
We only have built-in support for Disqus at the moment, if that doesn't fit your needs, you can just add html to site's `layouts/partials/comments.html`
|
||||||
|
|
||||||
|
##### Add extra header
|
||||||
|
If you want to load something(like *custom javascript*, *google fonts* etc.) in every page with header, then you can add them inside site's `layouts/partials/extra-headers.html`.
|
||||||
|
|
||||||
|
##### Add custom analytics
|
||||||
|
If you prefer to use different analytics system other than google analytics, then add them inside `layouts/partials/analytics.html`.
|
||||||
|
|
||||||
#### Add custom css
|
#### Add custom css
|
||||||
|
|
||||||
For adding custom css to the theme, you need to assign an array of references in `config.toml` like following:
|
For adding custom css to the theme, you need to assign an array of references in `config.toml` like following:
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
{{ range .Site.Params.CustomCSS -}}
|
{{ range .Site.Params.CustomCSS -}}
|
||||||
<link rel="stylesheet" href="{{ . | absURL }}">
|
<link rel="stylesheet" href="{{ . | absURL }}">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{ if templates.Exists "partials/extra-headers.html" -}}
|
||||||
|
{{ partial "extra-headers.html" . }}
|
||||||
|
{{- end }}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="page">
|
<body id="page">
|
||||||
|
@ -36,7 +39,7 @@
|
||||||
{{ block "footer" . -}}{{ end }}
|
{{ block "footer" . -}}{{ end }}
|
||||||
{{ $script := resources.Get "js/main.js" | minify | fingerprint -}}
|
{{ $script := resources.Get "js/main.js" | minify | fingerprint -}}
|
||||||
<script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }}></script>
|
<script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }}></script>
|
||||||
{{ template "_internal/google_analytics_async.html" . }}
|
{{ partial "analytics.html" }}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
1
layouts/partials/analytics.html
Normal file
1
layouts/partials/analytics.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{{ template "_internal/google_analytics_async.html" . }}
|
Loading…
Reference in a new issue