Document Tag List Tag

Note: After we type various tags into the document, we can use the document tag list tag to call these tags.

How to use:{% tagList 变量名 with limit="10" %}If variables are defined as tags{% tagList tags with limit="10" %}...{% endtagList %}

The supported parameters of tagList are:

  • Document IDitemId
    itemIdIf not specified, the ID of the current document is read by default. You can also manually specify it 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, setitemId="0"
  • Number of callslimit
    If not specified, up to 10 are displayed by default, and the range that can be set is 1~100.limitWhen it is not a paging list, supportoffsetMode, that is,Separation mode, if you want to get 10 pieces of data from item 2, you can set it tolimit="2,10".
  • Index lettersletter
    The range of values ​​that can be filled in is A-Z
  • Tag Class IDcategoryId
    If you need to display the tag of the specified category, you can usecategoryId="分类ID"To specify. If you need to specify multiple classification IDs, you can use English,Separate. likecategoryId="1,2,3".
  • Site IDsiteId
    siteIdGenerally, there is no need to fill in it. If you use the background multi-site management to create multiple sites and want to call data from other sites, you can specify itsiteIdTo implement the data calling the specified site.

tags is an array object, so it needs to be usedforLoop to output

item is a variable in the for loop body. The available fields are:

  • TagIDId
  • Tag titleTitle
  • Tag linkLink
  • Tag DescriptionDescription
  • Tag index lettersFirstLetter
  • Tag's classification IDCategoryId

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 templatestag/index.htmlEffective 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>