The best way to provide site-wide data?

Hi, I have a bunch of header data in my home template which I need to use in the content of other templates. It’s fairly trivial to use page.find within their Twig markup to locate the home page and fetch the data there but it seems a little off…

Is there a way to offer data storage in a similar way to the admin page blueprint forms, but readily available site-wide?

Hi @punchfighter, I use the site.yaml file to this in my Open Course Hub theme, perhaps that might be an option for you too?

Many example in that repo, but here is one for reference:

The Flex Directory Plugin stores data in the ‘user/data’ folder and contains Twig templates for you to use as examples how to use that data in your templates.

1 Like

See also my answer to a similar question recently, where I store reusable components in subdirectories of pages/components and then the dreaded page.find()

1 Like

Apparently future versions of Grav (v2?) will have a feature called “content blocks” but there’s nothing written about it, so not sure if that will be along the lines of what you are asking about.