Skip to content

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

Description

@mmcky

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is wrong or broken in a lecture or build

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions