Description: Get related documents of the current document.The logic of the related documents is: Get the adjacent documents of the same category according to the current document's document id.Therefore, this tag can only be used on the document detail page.
Usage:{% archiveList 变量名称 with type="related" limit="10" %}
If the variable is defined as archives{% archiveList archives with type="related" limit="10" %}...{% endarchiveList %}
type
The value is 'related' does not support the 'order' parameter.
type
The value is related, support like parameter.like="keywords|relation", the like parameter is not required by default, it automatically retrieves the other documents closest to the current document.If like="keywords" is specified, it will retrieve relevant documents based on the first keyword of the document.If like=“relation” is specified, only the documents related to the backend document editing interface settings will be displayed.
'archives' is an array object, so it needs to be usedfor
in a loop to output
item is the variable within the for loop, available fields include:
- Document ID
Id
- Document Title
Title
- Document Link
Link
- Document Keywords
Keywords
- Document Description
Description
- Document Category ID
CategoryId
- Document Views
Views
- Document Cover Image
Images
- Document Cover First Image
Logo
- Document cover thumbnail
Thumb
- Document comment count
CommentCount
- Document added time
CreatedTime
Timestamp, needs to format the timestamp to date format{{stampToDate(item.CreatedTime, "2006-01-02")}}
- Document update time
UpdatedTime
Timestamp, needs to format the timestamp to date format{{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
- Document tag
- Document model settings for other field parameters
Code example
Get related document tags, which can only be used on the document detail 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>