Declaration of Twig Variables

Good morning everybody:
I intend to develop a website using blogsite skeleton V2.0.0 (gravstatic) with the quark theme because it has a built-in sidebar and furthermore I was able to write a dropdown menu.
While analyzing the base.html.twig and blog.html.twig files, I came across multiple variables used by Twig.
My main issue is that I often do not know where they came from, i.e. where they were declared.
Here is my take and please tell me if I am correct or not:

Template Variable Origin

blog.html.twig hero_image

                      config.plugins.breadcrumbs.      breadcrumbs.
                      enabled                                   yaml
                      grid_size                                  quark.yaml


                      show_pagination                       all md files

                      collection.params.pagination      don't know

                      config.plugins.login.        plugins/login
                      enabled                               /login/login.yaml

                      config.plugins.pagination.  plugins/pagination/
                      enabled                           pagination.yaml

base.html.twig header.title

                      grid_size                          quark.yaml


It seems to me variables are declared in one of three ways:

  • Inside twig files using the set tag
  • in yaml or md files
  • In php files. If so how do I find out which php files?

The other thing that confuses me is the dot syntax.
For example: can we write the variable config.plugins.login.enabled as plugins.config.login.enabled, or are there specific rules dictating the manner in which you write the variable? If there is a tutorial or documentation about that matter please let me know.

@antoine0579 Some documentation on variables in Twig:

  • Theme Variables gives a list of variables that are available in Twig. Think of config object, site object, page object, theme object…
  • Twig Filters & Functions about filters and functions added by Grav to Twig.

Where do variables come from?
Some are defined by Twig, or Grav like page, others by themes and plugins. Some are evident like config.plugins.pagination..., config.theme..., page.header...
And sometimes you scratch your head… and you know you are about to discover another of Grav’s hidden gems…

Thank you for your response… By the eay ate there any rules for dot notation?

Yes there are ‘rules’ for variables. E.g equals foo['bar']

See the official Twig documentation on variables and further down