Missing key value in the case of simple key/value pairing #281
Answered
by
simonswiss
Thisisjuke
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
simonswiss
May 26, 2023
Replies: 1 comment
-
Hey! The A common approach here when gathering data for a collection is to "augment" the object with something that stores the const col = await reader.collections[resource].read(slug)
return { ...col, key: slug } That way the Hope it helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
simonswiss
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey!
The
slug
is not part of the data generated by Keystatic — since it's effectively stored as the file/folder name.A common approach here when gathering data for a collection is to "augment" the object with something that stores the
slug
, if you need it:That way the
key
property will be available alongside the rest of the data.Hope it helps!