fix: Always assign DEFAULT_CATEGORY

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.
This commit is contained in:
Justin Mayer 2026-10-11 19:01:27 +02:00
commit edd1f37cd4
9 changed files with 101 additions and 19 deletions

View file

@ -65,6 +65,10 @@ Basic settings
The default category to fall back on. The default is ``"misc"``.
To publish articles without any category, set ``DEFAULT_CATEGORY = None``
and ``USE_FOLDER_AS_CATEGORY = False``. Articles will then only have a
category if one is specified in their metadata.
.. data:: DISPLAY_PAGES_ON_MENU
Whether to display pages on the menu of the template. Templates may or may
@ -590,6 +594,8 @@ This would save your articles into something like
.. data:: CATEGORY_SAVE_AS
The location to save a category. The default is ``"category/{slug}.html"``.
Set this to ``""`` to disable category pages. Articles still keep their
categories, which can be used in URL patterns such as ``ARTICLE_SAVE_AS``.
.. data:: TAG_URL