Replies: 1 comment 9 replies
-
You can’t set dynamic tags that way. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey folks,
I've been struggling to find an answer to this one in issues or discussions so I'm hoping this post is different enough to make this discussion worthwhile.
Problem: Collections with tags I have added dynamically to pages when generating them from JSON data are empty.
Details
I make a lot of end of year lists. I've decided to store them as JSON files and I currently have a bunch of files that looks something like this:
src/lists/annual/2019.music.albums.json
Based off some solutions I found in issues on how to create pages from these files I'm doing the following to create a "paginatable" data structure out of these files
src/_data/lists/annual.js
I'm then paginating with the following code.
src/lists/annual/annual.njk
If you notice in the tags section I'm adding tags for the bits of meta data I want to create indexes for (category, year, subcategory). My issue is that when I try to create an index via a
collection
there are no pages with those tags.src/indexes/music.md
When I have tried to write in a hard-coded tag in the
annual.njk
file I get results from that collection/tag combo but for all of the data in the curly braces, I get empty collections.Is this some kind of order of operations issue where the data isn't resolved by the time the collections are generated?
Any help at all would be really appreciated.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions