This is an automated email from the ASF dual-hosted git repository.

martijnvisser pushed a commit to branch release-1.0
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 28313c93631e0990a14016b4decffd0d0b1147a7
Author: Martijn Visser <[email protected]>
AuthorDate: Wed Jan 21 15:42:51 2026 +0100

    [FLINK-38955][docs] Add canonical tag to generated Javadoc and Scaladoc
    
    (cherry picked from commit 8226f3b8b0f2da1fd5ed9d12ca1036551d6e4229)
---
 .github/workflows/docs.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/.github/workflows/docs.sh b/.github/workflows/docs.sh
index 4a60c79d8fb..346abf86179 100755
--- a/.github/workflows/docs.sh
+++ b/.github/workflows/docs.sh
@@ -62,8 +62,26 @@ mvn javadoc:aggregate -B \
     -Dspotless.check.skip=true \
     -Denforcer.skip=true \
     -Dheader="<a href=\"http://flink.apache.org/\"; target=\"_top\"><h1>Back to 
Flink Website</h1></a> <script>var 
_paq=window._paq=window._paq||[];_paq.push([\"disableCookies\"]),_paq.push([\"setDomains\",[\"*.flink.apache.org\",\"*.nightlies.apache.org/flink\"]]),_paq.push([\"trackPageView\"]),_paq.push([\"enableLinkTracking\"]),function(){var
 
u=\"//analytics.apache.org/\";_paq.push([\"setTrackerUrl\",u+\"matomo.php\"]),_paq.push([\"setSiteId\",\"1\"]);var
 d=document, g=d.createElement( [...]
+
+# Inject canonical tags into Javadoc HTML files to point to stable docs version
+CANONICAL_BASE="https://nightlies.apache.org/flink/flink-docs-stable/api/java";
+find target/site/apidocs -name "*.html" -type f | while read -r file; do
+    REL_PATH="${file#target/site/apidocs/}"
+    CANONICAL_URL="${CANONICAL_BASE}/${REL_PATH}"
+    sed -i "s|<head>|<head>\n<link rel=\"canonical\" 
href=\"${CANONICAL_URL}\">|" "$file"
+done
+
 mv target/site/apidocs docs/target/api/java
 pushd flink-scala
 mvn scala:doc -B
+
+# Inject canonical tags into Scaladoc HTML files to point to stable docs 
version
+CANONICAL_BASE="https://nightlies.apache.org/flink/flink-docs-stable/api/scala";
+find target/site/scaladocs -name "*.html" -type f | while read -r file; do
+    REL_PATH="${file#target/site/scaladocs/}"
+    CANONICAL_URL="${CANONICAL_BASE}/${REL_PATH}"
+    sed -i "s|<head>|<head>\n<link rel=\"canonical\" 
href=\"${CANONICAL_URL}\">|" "$file"
+done
+
 mv target/site/scaladocs ../docs/target/api/scala
 popd

Reply via email to