Features to expose to theme developers

There are some features I’d like to add to my theme, however they require features that are, for whatever reason, only available to site devs.

Take output formats as an example. I’d like to be able to automatically generate Netlify-specific files (_headers, etc.), but they are not a built-in output type. I don’t want to have to ask theme users to copy some files into their project when they should be able to just add "Netlify" to their output formats for the home page.

The items that come to mind for being exposed are:

  • BlackFriday rendering options
  • Overriding some or all defaults of the config.toml file. Examples:
    • enableRobotsTXT
    • footnoteReturnLinkContents
    • PygmentsStyle
    • [outputs]
  • Custom output formats

Another very useful feature to add to templates/themes is the ability to throw errors. That way we can validate user input and, instead of ignoring what the theme considers an invalid value, tell the user “hey, this parameter isn’t what I was expecting.”

Examples of validation could include:

  • HTML color codes
  • Any string used as an enumeration
  • Any number expected to be within a range
  • etc.
1 Like