Skip to content

bugfix: don't require category in drafts#3600

Open
sharmaeklavya2 wants to merge 1 commit into
getpelican:mainfrom
sharmaeklavya2:draft-category
Open

bugfix: don't require category in drafts#3600
sharmaeklavya2 wants to merge 1 commit into
getpelican:mainfrom
sharmaeklavya2:draft-category

Conversation

@sharmaeklavya2

@sharmaeklavya2 sharmaeklavya2 commented May 8, 2026

Copy link
Copy Markdown
Contributor

Draft articles seemed to unintentionally have 'category' as a required metadata key. I have made them optional, just like non-draft articles.

Background

This is how I found this bug: I recently upgraded pelican, and running pelican on my blog started throwing errors. Here is an excerpt from the traceback:

File "/Users/eklavya/code/repos/web/blog-source/blogVenv/lib/python3.14/site-packages/pelican/generators.py", line 691, in generate_pages
    self.generate_drafts(write)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "/Users/eklavya/code/repos/web/blog-source/blogVenv/lib/python3.14/site-packages/pelican/generators.py", line 670, in generate_drafts
    category=draft.category,
             ^^^^^^^^^^^^^^
AttributeError: 'Article' object has no attribute 'category'

My articles don't specify categories, and I don't use category subfolders. I use a custom pelican theme that completely ignores categories and uses tags instead.

After making the fix in this pull request, pelican started building my blog again.

Pull Request Checklist

  • Ensured tests pass and (if applicable) updated functional test output
  • Conformed to code style guidelines by running appropriate linting tools
  • Added tests for changed code (I'm not sure whether tests need to be added and where)
  • Updated documentation for changed code (no change to documentation required)

Draft articles seemed to unintentionally have 'category' as a
required metadata key. I have made them optional, just like
non-draft articles.
sharmaeklavya2 added a commit to sharmaeklavya2/blog that referenced this pull request May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant