HUGO

Best Practices: Insert content from /data/foo.yml or /content/foo/_index.md frontmatter?

Hugo noob here, but it appears to me that one can use /data/something.yml (or .toml or .json) files to define pieces of content with name/value pairs and then use them in by using {{ Site.Data.something.parameterValue }} of the content/somefolder/_index.html
OR
by putting it in the frontmatter of content/folderName/something.md and then calling it in a {{ define “parameter” }} in a child page block. (Which I don’t understand fully yet).

Is there a Best Practices on this?

I have a BUNCH of products that all have .yaml OR .md that I can put under name value pairs of:
productImages (for image slider)
productImageCaptions
poroductDescription
productSpecificatons
productFeatures
productOptions
productRelatedProducts

(for example).
Anybody following me?
:slight_smile:

Use frontmatter for data that is directly related to your page, use data folder for data that is not related to a specific page and can be consumed by your website

2 Likes