Declaring global variables in routes.yaml

Hi everyone!

I guess that would be quiet convinient if there was an oportunity to declare variables or to pass some named data in page context right through the routes.yaml file.
Let me introduce how I see it:

  • Let’s pick a custom collection
    Here we declare it in routes.yaml file

    collections:
       /my-collection/: // The url of the collection
          template: custom-one // The template
          permalink: /my-collection/{slug}/
          filter: 'tag:collected+tag:en'
    
  • What am I trying to propose:
    Imagine you could pass a piece of data like this:

    /my-collection/: 
      template: custom-one 
      permalink: /my-collection/{slug}/
      filter: 'tag:collected+tag:en'
      payload: // Or thms like this
        language: 'en' // Here is our variable
    

    And then you could use this data right in your template as it is in context like this:

    {{!< default}}
    <main>
       <h1>Language is {{lanuage}}</h1>
    </main>
    

PS

I would like Ghost team to implement this feature in future updates (or make Ghost themes fully multilanguage (!not staticly!:stuck_out_tongue:)).
But right now I’ll try to implement this feature myself. Could you please tell which node.js module is responsible for processing routes.yaml file and creating pages context?

Thanks in advance for your attention!