据我所知,我已经正确设置了我的部分/数据源。它设置为包括 system:pagination 并且每 3 个条目分页。
为了获得分页,我使用了一个流行的xslt 实用程序
这是存档/类别页面:
<xsl:import href="../utilities/master.xsl"/>
<xsl:import href="../utilities/pagination.xsl"/>
<xsl:import href="../utilities/get-article.xsl"/>
<xsl:template match="data">
<div class="col span-9">
<div class="span-9">
<h4 class="nudge-3"><xsl:value-of select="categories/entry/title[@handle = $category]"/></h4>
</div>
<xsl:apply-templates select="archive-listing/entry" mode="short"/>
<xsl:call-template name="pagination">
<xsl:with-param name="pagination" select="archive-listing/pagination"/>
<xsl:with-param name="pagination-url" select="{$current-url}/archive/category/{title/@handle}?page=$"/>
</div>
</xsl:call-template>
<div id="sidebar" class="col last span-3">
<xsl:call-template name="social"/>
<xsl:call-template name="category"/>
<xsl:call-template name="tag"/>
<xsl:call-template name="external-links"/>
</div>
</xsl:template>
</xsl:stylesheet>
这是我的 ?debug 显示唯一出现的分页:
<archive-listing>
<pagination total-entries="11" total-pages="4" entries-per-page="3" current-page="1" />
无论如何,这是解决方案。遵循 callovarne 的建议并按照他告诉我的步骤进行操作,我能够做到这一点。因此,如果您遇到该问题,请务必检查一下:
<xsl:apply-templates select="archive-listing/entry" mode="short"/>
<xsl:call-template name="pagination">
<xsl:with-param name="pagination" select="archive-listing/pagination"/>
<xsl:with-param name="pagination-url" select="concat($root, '/archive/category/', $category, '/$')"/>