how to extract image of a child page in apostrophe cms

末鹿安然 提交于 2020-02-06 08:42:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!