跳转到主要内容

原始Pelican Series插件的安装版本

项目描述

Pelican Series: Pelican的插件

This plugin extends the original series plugin by FELD Boris lothiraldan@gmail.com 版权所有 (c) Leonardo Giordani giordani.leonardo@gmail.com 此插件也位于 Pelican 插件仓库

此系列插件允许您将不同的帖子组合成一个系列。

为了将帖子标记为系列的一部分,请使用 :series: 元数据

:series:  NAME_OF_THIS_SERIES

或者,在 Markdown 语法中

Series: NAME_OF_THIS_SERIES

插件会收集属于同一系列的所有文章,并提供可用于模板中的系列相关变量。

索引

默认情况下,系列中的文章按日期排序,然后自动编号。

如果您想强制给定顺序,请指定 :series_index: 元数据或 Markdown 中的 series_index:,从 1 开始。所有具有此强制索引的文章都放在系列的开头,并按索引本身排序。所有剩余的文章跟在它们后面,按日期排序。

插件为您的模板提供以下变量

* `article.series.name` is the name of the series as specified in the article metadata
* `article.series.index` is the index of the current article inside the series
* `article.series.all` is an ordered list of all articles in the series (including the current one)
* `article.series.all_previous` is an ordered list of the articles published before the current one
* `article.series.all_next` is an ordered list of the articles published after the current one
* `article.series.previous` is the previous article in the series (a shortcut to `article.series.all_previous[-1]`)
* `article.series.next` is the next article in the series (a shortcut to `article.series.all_next[0]`)
* `article.series.first` is the first article in the series
* `article.series.last` is the last article in the series

例如

{% if article.series %}
    <p>This post is part {{ article.series.index }} of the "{{ article.series.name }}" series:</p>
    <ol class="parts">
        {% for part_article in article.series.all %}
            <li {% if part_article == article %}class="active"{% endif %}>
                <a href='{{ SITEURL }}/{{ part_article.url }}'>{{ part_article.title }}</a>
            </li>
        {% endfor %}
    </ol>
{% endif %}

将系列中的文章连接起来,并提供在模板中管理系列的变量。

安装

此插件可以通过以下方式安装

pip install pelican-series-plugin

接下来,将其添加到 pelicanconf.py 中的 PLUGINS 部分

PLUGINS = [
    '...',
    'pelican.plugins.series',
    '...'
]

贡献

欢迎并非常感谢贡献。每一份努力都很有帮助。您可以通过改进文档、添加缺失功能以及修复错误来贡献。您还可以通过审查和评论 现有问题 来提供帮助。

要开始为此插件做出贡献,请查看 向 Pelican 贡献 文档,从 向代码贡献 部分开始。

项目详情


下载文件

下载适合您平台的应用程序。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

pelican-series-plugin-1.1.1.tar.gz (4.4 kB 查看散列值)

上传时间

构建分布

pelican_series_plugin-1.1.1-py3-none-any.whl (4.2 kB 查看散列值)

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面