Is there a way to dynamically set frontmatter attributes at build time?

E.g., I’d like to set some pages’ description and summary frontmatter from info in data files. This is because they share the same descriptions. (And yep, I know to look out for SEO issues.)

And so I’d like to be able to read and set these Page or Page.Param values early in the build process. This way they’d be used by templates as if they’d been set in the markdown. Can these values be written to? It’d be nice because then I could the theme templates as-is.

It sounds like Hugo can do this for Scratches when they’re set in parent template. But to check Scratches I’d have to customize my theme files.

There is not a way to dynamically set front matter values at build time. You will need to use a page scratch or store.

1 Like

Thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.