说明:获取当前文档的相关文档。相关文档的逻辑是:根据当前文档的文档id,获取同分类的临近文档。因此该标签只能在文档详情页使用。
使用方法:{% archiveList 变量名称 with type="related" limit="10" %}
如将变量定义为 archives {% archiveList archives with type="related" limit="10" %}...{% endarchiveList %}
type
的值为 related 的情况下,不支持 order 参数。
archives 是一个数组对象,因此需要使用 for
循环来输出
Id
Title
Link
Keywords
Description
CategoryId
Views
Images
Logo
Thumb
CommentCount
CreatedTime
时间戳,需要使用格式化时间戳为日期格式 {{stampToDate(item.CreatedTime, "2006-01-02")}}
UpdatedTime
时间戳,需要使用格式化时间戳为日期格式 {{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
获取相关文档标签,只能在文档详情页使用。
{# related 相关文档列表展示 #}
<div>
{% archiveList archives with type="related" limit="10" %}
{% for item in archives %}
<li class="item layui-flex">
<a href="{{item.Link}}" class="link flex-item">
<h5 class="title">{{item.Title}}</h5>
<div class="description">{{item.Description}}</div>
<div class="meta">
<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}}" class="thumb">
<img class="thumb-image" alt="{{item.Title}}" src="{{item.Thumb}}">
</a>
{% endif %}
</li>
{% empty %}
<li class="item empty">
该列表没有任何内容
</li>
{% endfor %}
{% endarchiveList %}
</div>