How to set default values for multiple documents at once.

Variables like asset.title or asset.description are usually specific to just one document. But you often want to set variables for a whole group of documents based on their file name or the directory they reside in.

Such default values can be set with the configuration variable defaults in _qgoda.yaml using the powerful syntax of pattern lists.

The default values are just used for initialization. You can always override them in the document front matter.

The configuration variable defaults is a list (an array) that contains rules that are processed one by one for each matching document.

Each rule is a hash with the two keys files and values. With files you specify the matching documents, with values, the values you want to set for them.


    - files: /en
        lingua: en
    - files: /de
        lingua: de
        translate: ['title', 'description']

The value for files specifies the pattern, in values you set the default values for arbitrary variables.

You can also specify multiple patterns in files, simply by specifying an array instead of a single value:

    - files:
        - index.*
        - listing.*
        - '!/'
        type: listing

The above example would set the default value for type to "listing" for all files that match index.* and listing.* but not for / See for all the gory details of file name pattern matching.

This website uses cookies and similar technologies to provide certain features, enhance the user experience and deliver content that is relevant to your interests. Depending on their purpose, analysis and marketing cookies may be used in addition to technically necessary cookies. By clicking on "Agree and continue", you declare your consent to the use of the aforementioned cookies. Here you can make detailed settings or revoke your consent (in part if necessary) with effect for the future. For further information, please refer to our Privacy Policy.