This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new e17239c687d Hide 'Suggest a change' link on autoapi pages (#16654)
(#68637)
e17239c687d is described below
commit e17239c687d8a61e6c03bb47d6e847274595cb40
Author: Karthik S <[email protected]>
AuthorDate: Mon Jun 22 08:40:04 2026 +0530
Hide 'Suggest a change' link on autoapi pages (#16654) (#68637)
---
.../sphinx_templates/suggest_change_button.html | 31 +++++++++++++
devel-common/src/docs/utils/conf_constants.py | 1 +
.../src/sphinx_exts/suggest_change_button.py | 54 ++++++++++++++++++++++
3 files changed, 86 insertions(+)
diff --git a/devel-common/src/docs/sphinx_templates/suggest_change_button.html
b/devel-common/src/docs/sphinx_templates/suggest_change_button.html
new file mode 100644
index 00000000000..c298a8195e0
--- /dev/null
+++ b/devel-common/src/docs/sphinx_templates/suggest_change_button.html
@@ -0,0 +1,31 @@
+{#
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+ Override of sphinx_airflow_theme's suggest_change_button.html.
+
+ The button's edit URL is built 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, so the
+ URL 404s. Suppress the include entirely on those pages.
+
+ See: https://github.com/apache/airflow/issues/16654
+#}
+
+{% if not pagename.startswith('_api/') %}
+ {% include "!suggest_change_button.html" %}
+{% endif %}
diff --git a/devel-common/src/docs/utils/conf_constants.py
b/devel-common/src/docs/utils/conf_constants.py
index 1331c039553..33f8d300f31 100644
--- a/devel-common/src/docs/utils/conf_constants.py
+++ b/devel-common/src/docs/utils/conf_constants.py
@@ -95,6 +95,7 @@ BASIC_SPHINX_EXTENSIONS = [
"sphinx_design",
"pagefind_search",
"metrics_tables_from_registry",
+ "suggest_change_button",
]
# Properties for Swagger OpenAPI generation:
diff --git a/devel-common/src/sphinx_exts/suggest_change_button.py
b/devel-common/src/sphinx_exts/suggest_change_button.py
new file mode 100644
index 00000000000..a11e268c6fb
--- /dev/null
+++ b/devel-common/src/sphinx_exts/suggest_change_button.py
@@ -0,0 +1,54 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Sphinx extension to suppress the "Suggest a change on this page" button
+on autoapi pages (i.e. anything under ``_api/``).
+
+The ``sphinx_airflow_theme`` template constructs the edit URL from the
+page's pagename. For autoapi pages this always 404s, because the ``.rst``
+files are generated during the build and never exist in the repo. To work
+around this we register a local templates directory that shadows the
+upstream template: the local version renders nothing for ``_api/*`` and
+falls through to the upstream version for every other page.
+
+See: https://github.com/apache/airflow/issues/16654
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from sphinx.application import Sphinx
+ from sphinx.config import Config
+
+_TEMPLATES_DIR = Path(__file__).resolve().parents[1] / "docs" /
"sphinx_templates"
+
+
+def _register_templates_path(app: Sphinx, config: Config) -> None:
+ templates_path = list(config.templates_path or [])
+ shared = _TEMPLATES_DIR.as_posix()
+ if shared not in templates_path:
+ templates_path.append(shared)
+ config.templates_path = templates_path
+
+
+def setup(app: Sphinx) -> dict[str, bool | str]:
+ app.connect("config-inited", _register_templates_path)
+ return {"parallel_read_safe": True, "parallel_write_safe": True}