[en]Description: After we tag various tags on the document, we can use the document Tag list tags to call these tags.
Usage:{% tagList 变量名 with limit="10" %}
[en]As variables defined as tags{% tagList tags with limit="10" %}...{% endtagList %}
The supported parameters for tagList are:
- Document ID
itemId
itemId
If not specified, the default is to read the current document's ID, which can also 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 Quantity
limit
If not specified, the default maximum number of items displayed is 10, and the range that can be set is 1~100.limit
Supports pagination mode when it is not a pagination listoffset
That is to say,,
Mode of separation, if you want to start from the 2nd item and get 10 items, you can set it tolimit="2,10"
. - Index Letter
letter
The range of values that can be filled in is A-Z - Tag Classification ID
categoryId
If you need to display a specific category's Tag, you cancategoryId="分类ID"
to specify. If you need to specify multiple category IDs, use English,
separated. LikecategoryId="1,2,3"
. - Site ID
siteId
siteId
Generally, it is not necessary to fill in. If you have created multiple sites using the multi-site management on the backend and want to call data from other sites, you can do so by specifyingsiteId
To implement the call to data from a specified site.
tags 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:
- 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 is displayed in pages
The Document Tag list supports pagination, but only in the templatetag/index.html
it is effective.
<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>