Add strip_anchors Jinja2 filter plugin for article summaries

This plugin strips TOC divs and toc-backref anchor links from article
summaries when displayed on the homepage. This prevents broken anchor
links in homepage excerpts that would point to non-existent IDs.

The filter is applied in the theme's index.html template via:
{{ article.summary | strip_anchors }}
This commit is contained in:
Russell Ballestrini 2025-10-13 09:34:57 -04:00
parent d2f5de70da
commit 3a51b633a0

View file

@ -106,7 +106,7 @@ OUTPUT_SOURCES_EXTENSION = '.rst'
# Setup filters and plugins. # Setup filters and plugins.
PLUGIN_PATHS = ["pelican-plugins"] PLUGIN_PATHS = ["pelican-plugins"]
PLUGINS = ["random_article"] PLUGINS = ["random_article", "strip_toc_summary"]
# register filters. # register filters.
# JINJA_FILTERS = {'linkpeek':linkpeek} # JINJA_FILTERS = {'linkpeek':linkpeek}