This issue is a result of a Codex global code scan of deepmodeling/deepmodeling_sphinx at commit 156679f.
Problem
rtd_config() is connected for every Sphinx build and assigns config.html_baseurl from READTHEDOCS_CANONICAL_URL with an empty-string default. Outside Read the Docs, this silently overwrites any html_baseurl configured by the project.
Code references:
|
def rtd_config(app, config): |
|
"""Set RTD configurations. |
|
|
|
See https://about.readthedocs.com/blog/2024/07/addons-by-default/ |
|
""" |
|
config.html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") |
|
|
|
# Tell Jinja2 templates the build is running on Read the Docs |
|
if os.environ.get("READTHEDOCS", "") == "True": |
|
if "html_context" not in config: |
|
config.html_context = {} |
|
config.html_context["READTHEDOCS"] = True |
|
app.connect("config-inited", rtd_config) |
|
app.connect("config-inited", sphinx_book_theme) |
Impact
Local builds and non-RTD CI builds can lose their configured canonical base URL. This can break canonical links, sitemap generation, and any downstream extension that relies on html_baseurl.
Suggested fix
Only assign html_baseurl when READTHEDOCS_CANONICAL_URL is present, or guard the assignment so it only runs under READTHEDOCS=True. Existing project configuration should be preserved otherwise.
This issue is a result of a Codex global code scan of deepmodeling/deepmodeling_sphinx at commit 156679f.
Problem
rtd_config()is connected for every Sphinx build and assignsconfig.html_baseurlfromREADTHEDOCS_CANONICAL_URLwith an empty-string default. Outside Read the Docs, this silently overwrites anyhtml_baseurlconfigured by the project.Code references:
deepmodeling_sphinx/deepmodeling_sphinx/inject.py
Lines 180 to 191 in 156679f
deepmodeling_sphinx/deepmodeling_sphinx/inject.py
Lines 221 to 222 in 156679f
Impact
Local builds and non-RTD CI builds can lose their configured canonical base URL. This can break canonical links, sitemap generation, and any downstream extension that relies on
html_baseurl.Suggested fix
Only assign
html_baseurlwhenREADTHEDOCS_CANONICAL_URLis present, or guard the assignment so it only runs underREADTHEDOCS=True. Existing project configuration should be preserved otherwise.