Tag Document List Tags

Description: Used to get the document list of a specified Tag

Usage:{% tagDataList 变量名称 with tagId="1" %}If the variable is defined as archives{% tagDataList archives with tagId="1" %}...{% endtagDataList %}

The supported parameters of tagDataList are:

  • TagIDtagId tagIdCan retrieve the document list of a specified Tag such astagId="1"Retrieve the document list of TagID 1.

If not specifiedtagIdIt will try to read the current Tag page's TagID.

  • Model IDmoduleId moduleIdCan retrieve the document list of a specified document model such asmoduleId="1"Retrieve the document list of the article model.
  • the sorting methodorder orderCan specify the sorting rule for document display, supporting sorting by the latest documentsorder="id desc", documents with the most views sortedorder="views desc", sorted by custom sorting in the backgroundorder="sort desc"The default is to sort by custom order, and it can be left blank.
  • Show Quantitylimit limitYou can specify the number of items to display, and paginate by that number, for example,limit="10"It will only display 10 entries.limitSupports pagination mode when it is not a pagination listoffsetThat 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".
  • List typetype typeSupports listing by page or list. The default value is list.type="list"When, it will only display the specified limit of the specified quantity, iftype="page"Subsequent availablepaginationTo organize pagination display{% pagination pages with show="5" %}.
  • Page Tagpagination paginationTo organize pagination display{% pagination pages with show="5" %}.
  • Site IDsiteId siteIdGenerally, 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 specifyingsiteIdTo implement the call to data from a specified site.

'archives' is an array object, so it needs to be usedforin a loop to output

item is the variable within the for loop, available fields include:

  • Document IDId
  • Document TitleTitle
  • Document SEO TitleSeoTitle
  • Document LinkLink
  • Document KeywordsKeywords
  • Document DescriptionDescription
  • Document Model IDModuleId
  • Document Category IDCategoryId
  • Documentation specification linkCanonicalUrl
  • Document User IDUserId
  • PricePrice
  • InventoryStock
  • Document Reading LevelReadLevel
  • The original link of the documentOriginUrl
  • Document ViewsViews
  • Document Cover ImageImages
  • Document Cover First ImageLogo
  • Document cover thumbnailThumb
  • Document comment countCommentCount
  • Document added timeCreatedTimeTimestamp, needs to format the timestamp to date format{{stampToDate(item.CreatedTime, "2006-01-02")}}
  • Document update timeUpdatedTimeTimestamp, needs to format the timestamp to date format{{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
  • Document tag
  • Additional field parameters for the document

Code example

{# page 分页列表展示 #}
<div>
{% tagDataList archives with type="page" 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 %}
{% endtagDataList %}

    {# 分页代码 #}
    <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>