Skip to content

Commit 924f873

Browse files
authored
Merge pull request #14811 from nextcloud/backport/14800/stable33
[stable33] Prevent indexing of non-stable docs versions and publish stable-only crawl policy
2 parents d72313a + 46bd61c commit 924f873

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/sphinxbuild.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,23 @@ jobs:
504504
echo "has_changes=true" >> $GITHUB_OUTPUT
505505
fi
506506
507+
- name: Strip noindex from stable docs
508+
run: |
509+
# Strip noindex from stable docs – these are the canonical pages we want indexed
510+
if [ -d server/stable ]; then
511+
find server/stable -name '*.html' -print0 | \
512+
xargs -0 perl -pi -e 's{<meta name="robots" content="noindex, follow" />\n?}{}g'
513+
fi
514+
515+
- name: Write robots.txt
516+
run: |
517+
cat > robots.txt << 'EOF'
518+
User-agent: *
519+
# Only the stable version should be indexed
520+
Allow: /server/stable/
521+
Disallow: /server/
522+
EOF
523+
507524
# Remove the stage/ directory BEFORE creating the PR so it doesn't get committed
508525
- name: Clean up staging cache before commit
509526
run: rm -rf stage/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% extends "!layout.html" %}
2+
{% block extrahead %}
3+
{{ super() }}
4+
<meta name="robots" content="noindex, follow" />
5+
{% endblock %}

0 commit comments

Comments
 (0)