diff --git a/docs/publish-docs.sh b/docs/publish-docs.sh
index 8657204840..0263312ac9 100755
--- a/docs/publish-docs.sh
+++ b/docs/publish-docs.sh
@@ -83,6 +83,17 @@ mkdir -p "${DOCS_DIR}"
# Strip the 'tika/' component dir prefix so URLs are /docs/X.Y.Z/...
cp -r target/site/tika/* "${DOCS_DIR}/"
+# Canonical links are absolute (site.url + /tika/...), so the copy above doesn't
+# flatten them. Rewrite only the tag: page prose may quote /docs/tika/.
+CANONICAL_TIKA='&2
+ exit 1
+fi
# UI assets one level above docs/, since HTML uses ../../_/ relative paths.
# Replace wholesale: cp -r into an existing directory nests source as a
# subdirectory (publish/_/_/), so remove first to keep the layout flat.