Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Can I create other YAML files?

Started by Muut Archive 11 years ago · 2 replies · 442 views
11 years ago

Is it possible to create a separate YAML file and access it from TWIG? Right now I have a number of entries in my site.yaml file. This is fine, but really this stuff should be in a stand-alone file so that I can GIT it separate from the rest of the changes. So what I was wondering is whether GRAV supports the ability to have other YAML files. That way rather than using site.myparms I would use something like mystandalonefile.myparms?

11 years ago

Sure you can create a file in user/config/ folder and then access it via twig. For example:

/user/config/mydata.yaml

TXT
foo: bar

Then to display the value in Twig it's just:

TWIG
{{ config.mydata.foo }}
11 years ago

Oh that is completely awesome -- thank you! This product just keeps getting better the deeper you dig. Nicely done!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 674 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5337 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago