How to add Image Field to Blog Post Summary in Orchard CMS?

∥☆過路亽.° 提交于 2019-12-12 09:53:32

问题


Looking to display the Image Field in the Blog Post Summary on my Orchard site. It current displays on the blog post itself but not in the summary. How do I add it to the summary?


回答1:


The display of parts and fields is defined in the placement.info files found in each module. Assuming you're using the Image Field from the Contrib.ImageField module, You will need to override the default placement of the field for the summary display type (which is defined in Modules\Contrib.ImageField\Placement.info) which by default is:

<Match DisplayType="Summary">
  <Place Fields_Contrib_Image="-"/>
</Match>

You can do this by adding the following to your theme's placement.info file (note I have restricted this to the BlogPost content type only) e.g.

<Match ContentType="BlogPost">
  <Match DisplayType="Summary">
    <Place Fields_Contrib_Image="Content"/>
  </Match>
</Match>

This displays the image in the Content zone for the summary view of BlogPost content items. For more info on placement in Orchard see http://docs.orchardproject.net/Documentation/Understanding-placement-info




回答2:


You can use the Media Library Picker Field. I did the following steps to add image field to blog summary:

  1. add Media Library picker field to Blog-Post content Type

  2. then in the placement.info add the following

    <Match ContentType="Blog">
      <Match DisplayType="Summary">
        <Place Part_Image_Summary="Content">
     </Match>
    </Match>
    


来源:https://stackoverflow.com/questions/14131041/how-to-add-image-field-to-blog-post-summary-in-orchard-cms

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