rw.collections
Accessing Collections
const transformHook = (rw) => {
const { tags, items, slides } = rw.collections;
// Each collection is an array
console.log(tags); // [{ title: "Tag 1" }, { title: "Tag 2" }]
console.log(items); // [{ name: "Item 1", price: 10 }, ...]
};
exports.transformHook = transformHook;Working with Collection Data
Mapping Collection Items
const transformHook = (rw) => {
const { tags } = rw.collections;
// Create a comma-separated list of tag names
const tagList = tags.map(tag => tag.title).join(", ");
rw.setProps({
tagList
});
};
exports.transformHook = transformHook;Filtering Collections
Passing Collections to Templates
Using Collections in Templates
Collection Item Properties
Last updated
Was this helpful?

