问题
I am doing a navigation bar in apostrophe every new page that is created requests of requirement an image for the icon that is a singleton of image widget this is the field:
{
name: 'icon',
label: 'Icon',
type: 'singleton',
widgetType: 'apostrophe-images',
options: {
limit: 1,
minSize: [200,200],
aspectRatio: [1,1]
}
}
when I want to bring it in my general template I am trying this:
{%- for tab in data.home._children -%}
{%- set image = tab.icon or tab -%}
<li>
<a class="sidebar-main-link" href="{{ tab._url }}">
<img class = "icon" src = "{{apos.attachments.url (image.attachment, {size: 'full'})}}" />
{{tab.title}}
</a>
</ li>
{%- endfor -%}
but it does not work
回答1:
There is a new tutorial on the Apostrophe site covering this question in detail. Also see the answer to this question on StackOverflow.
来源:https://stackoverflow.com/questions/50769896/how-to-extract-image-of-a-child-page-in-apostrophe-cms