-
-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access collections using bracket notation #680
Comments
What templating engine are you working with? |
Liquid. Sorry, forgot to mention that 😅 |
Looks like there are some limitations with Liquidjs here. I added a bunch of tests here, you can have a look: https://github.com/11ty/eleventy/blob/master/test/TemplateRenderLiquidTest.js#L980 The ones prefixed with The short answer here is that you need to remove your spaces around your quoted strings. Also This might improve when the liquid upgrade ships #469. I’ll try to unskip the tests when that happens. |
Is your feature request related to a problem? Please describe.
I'm trying to create an include that renders the navigation for a given collection.
This collection is contextual and linked directly to the one and only tag each page is set to.
tags[0]
holds the name of my collection eg:apples
.I can access
collections.apples
with no issues (as expected) but I can not writecollections[ "apples" ]
(norcollections[ tags[0] ]
, of course).Describe the solution you'd like
I'd like to be able to use bracket notation to access collections as exposed.
Describe alternatives you've considered
Using a shortcode that takes
tags[0]
as an argument would solve my issue if I was able to access all collections inside the shortcode function (maybe this is already possible and I've missed it?).Additional context
Ended up adding a shortcode that takes
collections
andtags[0]
as arguments so I could search and replace with a regex.The text was updated successfully, but these errors were encountered: