Explain: After we tag various tags on the document, we can call these tags using the document Tag list tags.
Usage:{% tagList 变量名 with limit="10" %}If the variable is defined as tags{% tagList tags with limit="10" %}...{% endtagList %}
The parameters supported by tagList are:
- Document ID
itemIditemIdIf not specified, the ID of the current document is read by default, or it can be manually specified to read the Tag list of the specified document. If you want to display all Tags without automatically reading the Tag of the current document ID, then setitemId="0" - Call volume
limitIf not specified, the default maximum number of items displayed is 10, and the range that can be set is 1 to 100,limitSupport when it is not a paginated listoffsetmode, which is,delimiter mode, if you want to start from the second item and get 10 items, you can set it tolimit="2,10". - Index letter
letterThe range of values that can be filled in is A-Z - Tag Category ID
categoryIdIf you need to display a specified category tag, you cancategoryId="分类ID"specify it. If you need to specify multiple category IDs, you can,separate them with English. For examplecategoryId="1,2,3". - Site ID
siteIdsiteIdGenerally, it is not necessary to fill in, if you use the multi-site management on the backend to create multiple sites and want to call data from other sites, you can specifysiteIdTo call the data of the specified site.
tags is an array object and therefore needs to be usedforloop to output
item is the variable within the for loop, the available fields are:
- TagID
Id - Tag Title
Title - Tag Link
Link - Tag Description
Description - Tag Index Letter
FirstLetter - Tag's Category ID
CategoryId
Code example
<div>
文档Tag:
{% tagList tags with limit="10" %}
{% for item in tags %}
<a href="{{item.Link}}">{{item.Title}}</a>
{% endfor %}
{% endtagList %}
</div>
Document Tag list pagination display
Document Tag list supports pagination, but only in the templatetag/index.html生效 within.
<div>
{% tagList tags with type="page" limit="20" %}
<ul>
{% for item in tags %}
<li>
<a href="{{item.Link}}">
<h5>{{item.Title}}</h5>
<div>{{item.Description}}</div>
</a>
</li>
{% empty %}
<liå>
该列表没有任何内容
</li>
{% endfor %}
</ul>
{% endtagList %}
</div>
{# 分页代码 #}
<div>
{% pagination pages with show="5" %}
{# 首页 #}
<a class="{% if pages.FirstPage.IsCurrent %}active{% endif %}" href="{{pages.FirstPage.Link}}">{{pages.FirstPage.Name}}</a>
{# 上一页 #}
{% if pages.PrevPage %}
<a href="{{pages.PrevPage.Link}}">{{pages.PrevPage.Name}}</a>
{% endif %}
{# 中间多页 #}
{% for item in pages.Pages %}
<a class="{% if item.IsCurrent %}active{% endif %}" href="{{item.Link}}">{{item.Name}}</a>
{% endfor %}
{# 下一页 #}
{% if pages.NextPage %}
<a href="{{pages.NextPage.Link}}">{{pages.NextPage.Name}}</a>
{% endif %}
{# 尾页 #}
<a class="{% if pages.LastPage.IsCurrent %}active{% endif %}" href="{{pages.LastPage.Link}}">{{pages.LastPage.Name}}</a>
{% endpagination %}
</div>
</div>