How to use:{% archiveList 变量名称 with type="related" limit="10" %}
If you define a variable as archives{% archiveList archives with type="related" limit="10" %}...{% endarchiveList %}
type
If the value of related, the order parameter is not supported.
type
archives is an array object, so it needs to be usedfor
Loop to output
item is the variable within the for loop, the available fields are:)
- Document ID
Id
- Document title
Title
- Document link
Link
- Document keywords
Keywords
- Document description
Description
- Document Category ID
CategoryId
- Document view count
Views
- Document cover picture
Images
- First image of the document cover
Logo
- Document cover thumbnail
Thumb
- Number of document comments
CommentCount
- Document addition time
CreatedTime
Time stamp, need to use formatted timestamps as date format{{stampToDate(item.CreatedTime, "2006-01-02")}}
- Document update time
UpdatedTime
Time stamp, need to use formatted timestamps as date format{{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
- Document tags
- Other field parameters for document model settings
Code Example
Get relevant document tags, which can only be used on the document details page.
{# related 相关文档列表展示 #}
<div>
{% archiveList archives with type="related" limit="10" %}
{% for item in archives %}
<li>
<a href="{{item.Link}}">
<h5>{{item.Title}}</h5>
<div>{{item.Description}}</div>
<div>
<span>{% categoryDetail with name="Title" id=item.CategoryId %}</span>
<span>{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
<span>{{item.Views}} 阅读</span>
</div>
</a>
{% if item.Thumb %}
<a href="{{item.Link}}">
<img alt="{{item.Title}}" src="{{item.Thumb}}">
</a>
{% endif %}
</li>
{% empty %}
<li>
该列表没有任何内容
</li>
{% endfor %}
{% endarchiveList %}
</div>