diff --git a/.github/workflows/sphinxbuild.yml b/.github/workflows/sphinxbuild.yml
index ae43e960339..1e5bb441867 100644
--- a/.github/workflows/sphinxbuild.yml
+++ b/.github/workflows/sphinxbuild.yml
@@ -498,6 +498,23 @@ jobs:
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
+ - name: Strip noindex from stable docs
+ run: |
+ # Strip noindex from stable docs – these are the canonical pages we want indexed
+ if [ -d server/stable ]; then
+ find server/stable -name '*.html' -print0 | \
+ xargs -0 perl -pi -e 's{\n?}{}g'
+ fi
+
+ - name: Write robots.txt
+ run: |
+ cat > robots.txt << 'EOF'
+ User-agent: *
+ # Only the stable version should be indexed
+ Allow: /server/stable/
+ Disallow: /server/
+ EOF
+
# Remove the stage/ directory BEFORE creating the PR so it doesn't get committed
- name: Clean up staging cache before commit
run: rm -rf stage/
diff --git a/_shared_assets/templates/layout.html b/_shared_assets/templates/layout.html
new file mode 100644
index 00000000000..d9554d763f2
--- /dev/null
+++ b/_shared_assets/templates/layout.html
@@ -0,0 +1,5 @@
+{% extends "!layout.html" %}
+{% block extrahead %}
+ {{ super() }}
+
+{% endblock %}