0

I am using GRAV as a CMS for a site I am working on, which uses TWIG as a templating language. The site we have right now has both french and english versions, so we have external YAML files with all the content we need to localize the pages with their necessary content. Does anyone know how I can pull that YAML file into are page template so we can use the content from it as global variables. EX. so for our footer we can use something like<h2>{{footer.title}}</h2> as the title of the footer and then it will pull either from the french or the English YAML file based on the url.

Thanks

Brady
  • 733
  • 1
  • 6
  • 16

1 Answers1

0

Yes this can be done.

Create i.e. /user/config/specific.yaml

footer: title: "My title"

these files are parsed automatically. you can now use {{ specific.footer.title }} in your twig templates

see https://learn.getgrav.org/themes/theme-vars#adding-custom-variables

user26432
  • 1
  • 2