thegeeklab / hugo-geekblog

Hugo theme made for blogs
https://hugo-geekblog.geekdocs.de
MIT License
99 stars 40 forks source link

Google Analytics #3

Closed Virtualizestuff closed 4 years ago

Virtualizestuff commented 4 years ago

Is it possible to add google analytics?

xoxys commented 4 years ago

I don't like trackers and I don't want to integrate it in the theme, sorry. But you should be able to simply add it on your own. You just need to overwrite a partial from the head section and add the Hugo internal analytics template. You could use the file https://github.com/xoxys/hugo-geekblog/blob/master/layouts/partials/head/microformats.html copy this file to your page layout folder. The file should look like this:

{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
{{ template "_internal/google_analytics.html" . }}

For more details see https://gohugo.io/templates/partials/#partial-template-lookup-order and https://www.soberkoder.com/google-analytics-hugo/. Just make sure to overwrite the file in your page root layout folder. Don't manipulate files in the theme folder directly, this prevents future updates.

Virtualizestuff commented 4 years ago

Awesome thank you for the quick response!

xoxys commented 4 years ago

Cool. Feel free to open another issue if you can't get it to work.