Parameters in themes

Custom params in Hugo.

Custom themes sometimes need to set extra parameters to be used in templates. You can set custom parameters as well as override some of Hugo’s default configuration by creating a config.json file in your theme.

Here’s an example of what a config file might look like:

{
  "rssLimit": 20,
  "params": {
    "color": "green"
  }
}

These values are applied over Micro.blog’s default config file. To use a parameter in a template, reference it like {{ .Site.Params.color }}.

The following configuration fields can be set:

  • params
  • pygmentsCodeFences
  • pygmentsStyle
  • blackfriday
  • defaultContentLanguage
  • disableKinds
  • enableEmoji
  • googleAnalytics
  • hasCJKLanguage
  • languageCode
  • languageName
  • paginate
  • paginatePath
  • related
  • rssLimit
  • summaryLength

For a tutorial on using parameters in custom themes, see this video on YouTube.