Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Can I create other YAML files?

Started by Muut Archive 10 years ago · 2 replies · 306 views
10 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?

10 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 }}
10 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 Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago