shivannakarthik opened a new pull request, #68637:
URL: https://github.com/apache/airflow/pull/68637
Closes the autoapi half of #16654
## Summary
The `sphinx_airflow_theme` template `suggest_change_button.html` builds the
edit URL from `pagename + conf_py_path + ".rst"`. For autoapi- generated
reference pages (those under `_api/`) the `.rst` files are
produced at build time and never committed to the repo, so the resulting URL
404s.
This PR adds a small Sphinx extension that registers a shared templates
directory containing an override of `suggest_change_button.html`. The override
delegates to the upstream template for every page except those
under `_api/`, where it renders nothing — removing the broken link without
affecting any other page.
## What changed
- New extension `devel-common/src/sphinx_exts/suggest_change_button.py`.
Hooks the Sphinx `config-inited` event and appends the shared template
directory to `config.templates_path`. The append is idempotent.
- New template
`devel-common/src/docs/sphinx_templates/suggest_change_button.html`.
Conditionally includes the upstream theme template only for non-`_api/` pages:
`{% if not pagename.startswith('_api/') %}{% include
"!suggest_change_button.html" %}{% endif %}`.
- Registered the extension in `BASIC_SPHINX_EXTENSIONS`
(`devel-common/src/docs/utils/conf_constants.py`) so every Airflow doc
package picks it up automatically.
## How to verify
`uv run --group docs build-docs apache-airflow --docs-only
./docs/start_doc_server.sh`
- Open any non-`_api/` page (e.g. `index.html`, `start.html`) — the
"Suggest a change on this page" button still appears in the bottom corner and
the GitHub edit URL works.
- Open any `_api/*` page (e.g.
`/docs/apache-airflow/stable/_api/airflow/triggers/index.html`) — the button
is suppressed; no broken link.Verified locally: regular pages render
`class="suggest-change-link"`exactly once; autoapi pages render zero
occurrences.
## Out of scope
The "button is visually too large" half of #16654 is a CSS issue
in`apache/airflow-site` and will be addressed in a separate PR there (working
on it)
This PR was prepared with the assistance of Claude. All code was reviewed
line-by-line. The override template logic was hand-verified against
`sphinx_airflow_theme`'s upstream `suggest_change_button.html`. The change was
tested locally by building docs for `apache-airflow` and the `amazon` provider
package and confirming the button is suppressed only on `_api/*` pages.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]