惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
S
SegmentFault 最新的问题
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
I
InfoQ
U
Unit 42
博客园_首页
GbyAI
GbyAI
Hugging Face - Blog
Hugging Face - Blog
罗磊的独立博客
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 聂微东
T
Tailwind CSS Blog
量子位

Pelican – A Python Static Site Generator

Pelican 4.12 released Pelican 4.11 released Pelican 4.10 released Pelican 4.9 released New Pelican Site, Docs Theme, and Discussions Pelican 4.8 released Pelican 4.7 released Migrating Plugins to New Organization Pelican 4.5 released Pelican Sprint — Fall 2019 Pelican 4.1 released Pelican 4.0 released Pelican 3.7 released Pelican 3.6 released Pelican 3.5 released Pelican 3.4 released I18N Subsites plugin released Pelican 3.3 released Using Pelican with Heroku Pelican 3.2 released Pelican's Unified Codebase Pelican 3.1 released Pelican 3.0 released Pelican now has a blog of its own!
Pelican 4.6 released
Pelican Cont · 2021-03-23 · via Pelican – A Python Static Site Generator

Pelican 4.6 is now available. Thanks to Tom Adler’s contribution, this release contains a new feature that allows for more SEO-friendly index pages, whereby /page-1/ contains the oldest articles, with newer articles placed on /page-2/, /page-3/, etc. That way, the names of the previous article index pages do not change every time a new index page is generated. Cool URLs don’t change!

To enable this feature, first add a pagination pattern for -1 to your Pelican settings file. For example:

PAGINATION_PATTERNS = (
    (1, "{base_name}/page-1/", "{base_name}/page-1/index.html"),
    (2, "{base_name}/page-{number}/", "{base_name}/page-{number}/index.html"),
    (-1, "{base_name}/", "{base_name}/index.html"),
)

You will also benefit from changing other settings to match the intended behavior. For example:

DEFAULT_PAGINATION = 5
DEFAULT_ORPHANS = 4
ARTICLE_ORDER_BY = "date"
REVERSE_ARCHIVE_ORDER = True
NEWEST_FIRST_ARCHIVES = True

In your theme’s index.html and tag.html templates, change the object_list loop to object_list[::-1] to reverse the order of the article list:

{% for article in articles_page.object_list[::-1] %}

Make sure the pagination links below the list are changed to reflect the switched direction of “next” vs. “previous” articles. For example:

{% if articles_page.has_next() %}
    <a class="pagination-item newer" href="{{ SITEURL }}/{{ articles_next_page.url }}">next</a>
    {% else %}
    <span class="pagination-item newer">next</span>
{% endif %}
{% if articles_page.has_previous() %}
    <a class="pagination-item older" href="{{ SITEURL }}/{{ articles_previous_page.url }}">previous</a>
    {% else %}
    <span class="pagination-item older">previous</span>
{% endif %}

While this is general guidance and will apply differently depending on your chosen theme, hopefully the above helps you get further along experimenting with this new feature.

This new release also includes the following enhancements, fixes, and tweaks:

  • Speed up livereload Invoke task via caching (#2847)
  • Ignore None return value from get_generators signal (#2850)
  • Relax dependency minimum versions and remove upper bounds

For more info, please refer to the release page or the Release History section of the documentation. For the full list of changes, see: https://github.com/getpelican/pelican/compare/4.5.4...4.6.0

Upgrading from previous releases

Upgrading from Pelican 4.5.x should be smooth and require few (if any) changes to your environment. If upgrading from a previous release, review the other release announcements on this site to better understand what action might be necessary.

As always, we do everything we can to maximize backwards compatibility and ensure smooth Pelican upgrades. If you run into problems, please see the How to Get Help section of the documentation, and we will update this post with any upgrade tips contributed by the Pelican community.