Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Can I create other YAML files?

Started by Muut Archive 11 years ago · 2 replies · 379 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 Deleted User, 9 years ago
0 2289 9 years ago
Archive · by Muut Archive, 9 years ago
2 1504 9 years ago
Archive · by Muut Archive, 9 years ago
2 4754 9 years ago
Archive · by Muut Archive, 9 years ago
1 3570 9 years ago
Archive · by Muut Archive, 9 years ago
3 1627 9 years ago