Last active
January 25, 2016 03:26
-
-
Save budparr/70299d15adf0f3875728 to your computer and use it in GitHub Desktop.
get a config defined variable for a collectionhttps://github.com/jekyll/jekyll/issues/4392#issuecomment-174369983
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If I have a _config.yml with: | |
collections: | |
my_collection: | |
foo: bar | |
And a template with | |
``` | |
{% assign collectionName = 'my_collection' %} | |
or | |
{% assign collectionName = page.collection %} | |
{% assign d = site.collections | where:'label',collectionName | first %} | |
{{ d.foo }} | |
``` | |
My output is, as expected: | |
bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment