Single Page List Label

Description: Used to get a single page list

Usage:{% pageList 变量名称 %}If the variable is defined as pages{% pageList pages %}...{% endpageList %}

Parameters supported by pageList

  • Site IDsiteId siteIdGenerally, 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.

pageList This tag will retrieve all pages. If you need to exclude certain pages, you can remove the unwanted pages in the subsequent for loop.

pages is an array object, therefore it needs to useforloop to output

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

  • Single page IDId
  • Single Page TitleTitle
  • Single Page LinkLink
  • Single Page DescriptionDescription
  • Single Page ContentContent
  • Single Page Thumbnail Large ImageLogo
  • single page thumbnailThumb

Code example

<ul>
{% pageList pages %}
    {% for item in pages %}
    <li>
        {#  如需判断当前是否是循环中的第一条,可以这么写: #}
        {% if forloop.Counter == 1 %}这是第一条{% endif %}
        {# 比如需要给第一条添加额外class="active",可以这么写: #}
        <a class="{% if forloop.Counter == 1 %}active{% endif %}" href="{{item.Link}}">{{item.Title}}</a>

        <a href="{{ item.Link }}">{{item.Title}}</a>
        <a href="{{ item.Link }}">
            <span>当前第{{ forloop.Counter }}篇,剩余{{ forloop.Revcounter}}篇</span>
            <span>单页ID:{{item.Id}}</span>
            <span>单页名称:{{item.Title}}</span>
            <span>单页链接:{{item.Link}}</span>
            <span>单页描述:{{item.Description}}</span>
            <span>单页内容:{{item.Content|safe}}</span>
        </a>
        <div>缩略图大图:<img src="{{item.Logo}}" alt="{{item.Title}}" /></div>
        <div>缩略图:<img src="{{item.Thumb}}" alt="{{item.Title}}" /></div>
    </li>
    {% endfor %}
{% endpageList %}
</ul>
{# 排除id为1的页面 #}
{% pageList pages %}
    {% for item in pages %}
    {% if item.Id != 1 %}
    <li>
        <a href="{{ item.Link }}">{{item.Title}}</a>
        <a href="{{ item.Link }}">
            <span>单页ID:{{item.Id}}</span>
            <span>单页名称:{{item.Title}}</span>
            <span>单页链接:{{item.Link}}</span>
            <span>单页描述:{{item.Description}}</span>
            <span>单页内容:{{item.Content|safe}}</span>
        </a>
        <div>缩略图大图:<img src="{{item.Logo}}" alt="{{item.Title}}" /></div>
        <div>缩略图:<img src="{{item.Thumb}}" alt="{{item.Title}}" /></div>
    </li>
    {% endif %}
    {% endfor %}
</ul>
{% endpageList %}