Skip to content

Loop over localized collections not working as expected #1875

Answered by pdehaan
madsem asked this question in Q&A
Discussion options

You must be logged in to vote

I have 3 very rough debugging ideas.

But first, a couple little filters:

eleventyConfig.addFilter("inspect", require("util").inspect);
eleventyConfig.addFilter("keys", (obj) => Object.keys(obj).sort());
  1. Create a new page and add something like {{ collections | keys | inspect }}. That should hopefully tell us which collection names are currently created. My guess is that there isn't a collections.products_en created.
  2. Put {{ tags | inspect }} on one of your pages to make sure that it's doing what you think it's doing.
  3. Put {{ posts | inspect }} right after {% set posts = collections["products_" + locale] %} and confirm that it returns an array of some products. I'm guessing the value is an …

Replies: 4 comments 20 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by madsem
Comment options

You must be logged in to vote
2 replies
@pdehaan
Comment options

pdehaan Jul 3, 2021
Collaborator

@pdehaan
Comment options

pdehaan Jul 3, 2021
Collaborator

Comment options

You must be logged in to vote
1 reply
@madsem
Comment options

Comment options

You must be logged in to vote
17 replies
@pdehaan
Comment options

pdehaan Jul 5, 2021
Collaborator

@madsem
Comment options

@madsem
Comment options

@madsem
Comment options

@madsem
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants