QuantEcon / QuantEcon/quantecon-book-theme

Page header renders the literal string "Author name not set" on Sphinx 7.4+

Open
#428 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Jupyter Notebook
Stars
56
Forks
24
Avg merge
4h 33m
Merged PRs (30d)
4

Description

A site that configures neither the theme's authors option nor Sphinx's own author value renders the literal text Author name not set in the page header, on every page.

Reproduce

A minimal conf.py with no author and no authors:

project = "No Author"
master_doc = "index"
html_theme = "quantecon_book_theme"

The built page contains <p class="qe-page__header-authors" font-size="18">Author name not set</p>.

Cause

src/quantecon_book_theme/__init__.py:532 guards the author fallback against Sphinx's placeholder value:

if app.config.author != "unknown":
    context["author"] = app.config.author

Sphinx changed that placeholder. Sphinx 5 and 6 defaulted author to unknown, but Sphinx 7.4 and later default it to Author name not set, so the guard no longer matches and the placeholder flows through to the template's author fallback in layout.html. The theme pins sphinx>=7,<9, so every supported version from 7.4 up is affected.

Verified against Sphinx 8.2.3: Config({}, {}).author returns 'Author name not set'.

Note on the fix

Checking for both placeholder strings in this repo is probably not sufficient on its own. sphinx_book_theme sets context["author"] with the same stale guard, so the value can arrive from there regardless of what this theme does. Since add_to_context is connected last, the more robust fix is to clear the key outright when the config value is one of the known placeholders, rather than only declining to set it.

Worth noting that the fixtures site masks this: _config.yml sets author: QuantEcon, so the visual snapshots would not show the regression even though downstream books are affected.

Found while implementing #426. That PR touches the adjacent conditional in the same template block but neither introduces nor fixes this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/quantecon_book_theme/init.py around line 532 and inspect how the author context reaches layout.html. Reproduce the issue with the minimal conf.py on Sphinx 8.2.3, then compare the context behavior with sphinx_book_theme. Done means a build with no author omits the placeholder while a configured author still appears in the page header.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.