Description: Get relevant documents for the current document. The logic of the relevant documents is: obtain adjacent documents of the same category based on the document id of the current document. Therefore, this tag can only be used on the document details page.
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
If the value of related, the like parameter is supported. like="keywords|relation", the like parameter is not required by default, it automatically obtains other documents closest to the current document. If like="keywords" is specified, the relevant document will be obtained based on the first keyword of the document. If like="relation" is specified, only relevant documents set by the background document editing interface will be displayed.
archives is an array object, so it needs to be usedfor
Loop to output
item is a variable in the for loop body. The available fields are:
- Document ID
Id
- Document title
Title
- Document link
Link
- Document keywords
Keywords
- Document description
Description
- Document Classification 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>