Loop in _config.yml

I would like to make a loop that sets defaults for a specific collection as following:

scope:
  path: "[collectionName]/[folderName]"
values:
  customFrontMatterVariable: [folderName]

so that I don’t have to update _config.yml each time I add a new folder in the collection. The goal is each customFrontMatterVariable in this collection’s objects to have its folder name as value.

I guess I could use a workaround with no loop using categories’ variables but it would indeed be a “workaround” resulting in incorrect semantic in my project (categories taxonomy apply to posts but not to every object).

  • Can we loop in _config.yml?
  • Otherwise wouldn’t it be phantasmagorical to ask for this feature?
  • Otherwise do you have an idea for a better workaround that preserves project taxonomy?