gethugothemes / dot-hugo

Dot - Hugo Documentation Theme
https://gethugothemes.com/products/dot/?utm_source=dot_github&utm_medium=referral&utm_campaign=github_theme_about
MIT License
260 stars 148 forks source link

Add local extension to header partial #150

Closed davidsneighbour closed 3 years ago

davidsneighbour commented 4 years ago

I have a use case where I would like to add custom content before the </head> tag. This change implements that. Users can add locally (either in their overriding theme or in the root directory) add /layouts/partials/overrides/header.html and the content is printed at that location.

I see multiple uses for this, after <body>, before </body>... The path in templates.Exists must be run through printf for some reason.

tfsomrat commented 4 years ago

hey @davidsneighbour

Thanks for your concern, we appreciate your work. I think with google tag manager we can achieve this ,that solution is more convenient for the user. what do you think ?

davidsneighbour commented 4 years ago

That would impede the speed: GTM requires a Javascript to be loaded. That Javascript might not be executed when a bot is loading the site. Think about "ownership verification" meta tags by ahref.com or Google themselves. You can't hope that they execute Javascripts when they look for these tags. With a local template and a proper minification on staging this will be a one-step task for the website owner. With GTM there is learning involved and breaking it all with an unrelated tag there is possible too.

LongLiveCHIEF commented 3 years ago

I like this, but I'll admit that calling it "overrides" tripped me up (since you can override theme partials by adding your own of the same name in a more specific location).

@davidsneighbour would you consider calling it injections or something similar instead of overrides?, since it's not overriding anything, but extending?