gnugat / carew-next

此包已被废弃且不再维护。未建议替代包。

carew 插件,增加 next_document 和 previous_document 函数

v1.0.0 2015-04-09 18:34 UTC

This package is auto-updated.

Last update: 2022-02-01 12:46:22 UTC


README

此 Carew 插件增加了两个新功能

  • next_document()
  • previous_document()

使用这些功能,您将能够自动创建指向下一页和上一页的链接

{% block content_main %}
    {{ carew.document.body|raw }}

    <ul>
        {% set next = next_document(carew.posts, carew.document) %}
        {% if next %}
        <li>Next: <a href="{{ render_document_path(next) }}">{{ next.title }}</a></li>
        {% endif %}

        {% set previous = previous_document(carew.posts, carew.document) %}
        {% if previous %}
        <li>Previous: <a href="{{ render_document_path(previous) }}">{{ previous.title }}</a></li>
        {% endif %}
    <ul>
{% endblock %}

安装

使用 Composer

composer require "gnugat/carew-next:~1.0"

然后注册插件

engine:
    extensions:
        - Gnugat\CarewNext\NextExtension

更多文档

您可以使用以下方式查看当前和过去版本:

您可以在以下链接中找到更多文档: