Hook into generation process and replace pieces of template

Is there a way to hook at the end of the HTML generation process of each content and be able to :

  • Generate a partial based on the current content data then
  • Replace some piece of the generated content with the partial generated ?

For example we could generate a seo related template and then replace necessary html tags in the head. And then all the themes could be SEO optimized themes

I hope it’s clear ! :slight_smile:

I have tried a lot of different approaches with theme components etc … but as all themes have their own structure and logic you can’t fit many themes with this technique.

Any idea or help would be super welcome !


Yes, one may use a template to produce output across themes, components, and sites.

You have described “templating” in broad terms, so which technique are you referring?

I suggest building a quick site with Hugo, to understand what it does.


I just created a quick site to illustrate what I try to achieve : https://github.com/aldric/hugo-multi