You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ma...@apache.org on 2026/02/19 13:27:40 UTC
(flink) 02/02: [FLINK-38955][docs] Add canonical tag to generated Javadoc and Scaladoc
This is an automated email from the ASF dual-hosted git repository.
martijnvisser pushed a commit to branch release-1.8
in repository https://gitbox.apache.org/repos/asf/flink.git
commit ea21d91ac8390265d9a621857a2551f8c4d43ef5
Author: Martijn Visser <29...@users.noreply.github.com>
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 bbad00fdccd..23947a9fd24 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