how to add custom code to <head>?
I want to add trackers that are not google analytics, so Just was to be able to easily add code snippets te
on each page. adding something like /layouts/partials/custom_head.html doesn't seem to work
I think google tag manager can create a tag with multiple scripts in it, so you could try that.
Otherwise, you can override the analytics partial
- Copy
themes\hugo-saasify-theme\layouts\partials\google-analytics.htmltolayouts\partials\google-analytics.html - Add your tracker code to
layouts\partials\google-analytics.html
The GA partial has an if hugo.IsProduction condition so if you put your script inside the if block it won't show when testing locally.
Thanks! #2 helps, but I'd vote for a nicer solution e.g separate file for head, body etc.
The theme author doesn't seem to be responding so we are left with hacks from other users like me 😄
I am back from a trip now. I will add the support of Google Tag Manager container to the solution later.
Please add something generic for head and footer.