When `CATEGORY_SAVE_AS` is disabled but `CATEGORIES_SAVE_AS` is not,
the category index page was still generated, and its links pointed to
category pages that don't exist. This change shows category names
without links in the Simple and NotMyIdea themes in such cases and also
documents that both settings must be disabled to remove all
category-related output.
PR #3589 tied category assignment to `CATEGORY_SAVE_AS`, so disabling
category pages also removed article categories and broke `{category}`
in URL patterns (#3596). PR #3597 restored folder-based categories, but
articles outside a subfolder still lost `DEFAULT_CATEGORY`. This change
assigns it again, so `CATEGORY_SAVE_AS` only controls whether category
pages are generated. Setting `DEFAULT_CATEGORY = None` is now the
documented way to have no categories.
This also stops the Simple and NotMyIdea themes from linking to category
pages that don't exist.
- Check that pages with an empty or `None` title fail validation.
- Use a fixed date in the article test.
- Add a reader-level test using the empty `:title:` source from #3566 to
confirm readers produce an empty title that is then rejected.
On systems such as Windows, JavaScript files can be incorrectly assigned
the "text/plain" MIME type in Python's mimetypes module. This overrides
this behavior when it occurs.
* Strip TOC elements from article summaries
Automatically remove table of contents divs and toc-backref anchor links
from article summaries when displayed outside full article context
(e.g., on homepage, in RSS feeds).
ReStructuredText automatically generates anchor links in section headings
when a table of contents directive is present. These anchors work perfectly
on full article pages, but become broken links when article summaries appear
on homepage or in feeds - the anchor targets don't exist in that context.
This change adds a strip_toc_elements_from_html() function in pelican/utils.py
that uses regex to remove:
- TOC div blocks (<div class="contents">...</div>) containing broken navigation
- toc-backref anchor links from headings while preserving heading text
Both removals are necessary since TOC anchor targets don't exist in summary context.
The function is called automatically in Content.get_summary() so all
summaries are cleaned without requiring configuration or template changes.
Includes comprehensive unit tests covering various TOC formats, edge cases,
and case-insensitive matching.
---------
Co-authored-by: Justin Mayer <entroP@gmail.com>
This fixes `invoke setup` failing in fresh virtual environments.
The top-level import of `livereload` caused tasks.py to fail before any
task could execute, since `livereload` is a development dependency only
installed by PDM as part of the setup task.
Folks tend to ignore the comments in issue templates and create new
issues, even when the issue template comments make it clear that we
would prefer that folks create discussions for topics outside of bug
reports, documentation issues, and feature requests.