Hi,
I have a block-factory and added a block for related pages. How can I access the fields of a page in the index.js of the block-factory?
A project page has a field, named cover, which is of ´type files´ and ´multiple: false´ which I want to access for each related page. But I only have access to a generic (first) image of a related page.
´content.related[0].image.url´
here is some more code:
block-factory raleted-pages .yml
name: Related-Pages
fields:
related:
type: pages
query: site.page('projects').children
max: 3
index.js
'related-pages': {
template: `
<div style="" @dblclick="open">
<div>RELATED PAGES BLOCK</div>
<div v-if="content.related && content.related.length > 0">
<div :style="{backgroundImage: 'url(' + content.related[0].image.url + ')'}"></div>
</div>
<div v-else style="color: #888; font-size: .8rem;">No related pages yet…</div>
</div>
</div>
`
},