Data folder best practices

Hugo provides data file feature

I have some question about usage and practices as theme developer. Today I’m developing theme and this theme becomes more and more customizable, thus more and more configuration keys are created.

What do you think about data file for theme customization? For example, I allow user to customize date format

  dateFormat = "2 January 2006"

but I saw some theme developer uses data file to customize such information, see

Other use case is to override copyright, by default my theme is displaying theme like following:

© 2016 Thibaud Leprêtre. All Rights Reserved

© {{ .Now.Format "2006" }} {{ }}. {{ i18n "footer.copyright" }}

But someone request me to be able to add link associated to {{ }} thus I created this param (that will be used if present or fallback to above version)

  copyright = "<a href=\"#an-url\">Your Name</a>"

to allow customize © 2016 <CUSTOMIZATION>. All Rights Reserved.

How can I determine if it’s better to create config.toml param or data ? Do you think is good idea to add configuration and not direct content (data) inside data file?


Have you managed to use data file or config.toml file and so why ?

I think I need hot reload, since config.toml isn’t hot-reloaded i guess i have to go with a “data/website_config/XXXX.json” parameter type of logic.

Anyone have advice that the data shouldn’t be used for config parameters?

  • Thanks