Params vs Data?

Hi, I’m refactoring an old site that’s getting a lot bigger, and hasn’t been touched since Hugo 0.40 days. It doesn’t use data (data/, .Site.Data) at all, but makes heavy use of site-wide params (for config like socal media handles). Which should I favour these days? The docs for each don’t even mention the other.

I get that params is hierachical, looking first in the page’s frontmatter then the site Params.
Params is available as a shortcode, Data isn’t.
Data can fetch over the network, Params is hard-coded.

Should I be using one? The other? Both for different things?

Thanks!
matt

While I’m here, some common site data like Copyright (author, etc) are first-class in the config file, ie a top-level key, and available right at .Site.Copyright. Except… copyright isn’t listed as a config key any more (but isn’t rejected and .Site.Copyright still works). Is this becuase the docs are a bit lacking, or becuase that’s deprecated and I’m meant to use params / data?

.Site.Copyright is documented and not deprecated.

The latter. The data folder is used to store files from other sources.
The .Site.Params table in a project’s config offers a convenient way to access custom settings from the global scope.

The variable is documented, the configuration key isn’t, hence my confusion.

Ok thanks, that’s really useful!

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