Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add robots.txt to Cilium documentation #19578

Merged
merged 1 commit into from
Apr 26, 2022
Merged

Conversation

aanm
Copy link
Member

@aanm aanm commented Apr 26, 2022

It looks that we can't do a Page redirect from 'robots.txt' in
readthedocs settings. This commit is another attempt of having a
manually defined robots.txt file.

Signed-off-by: André Martins andre@cilium.io

@aanm aanm added the release-note/misc This PR makes changes that have no direct user impact. label Apr 26, 2022
@aanm aanm requested a review from a team as a code owner April 26, 2022 13:43
@aanm aanm requested a review from qmonnet April 26, 2022 13:43
Documentation/conf.py Outdated Show resolved Hide resolved
It looks that we can't do a Page redirect from 'robots.txt' in
readthedocs settings. This commit is another attempt of having a
manually defined robots.txt file.

Signed-off-by: André Martins <andre@cilium.io>
@aanm aanm merged commit 7d30daf into cilium:master Apr 26, 2022
@aanm aanm deleted the pr/fix-robots branch April 26, 2022 13:58
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.11.5 Apr 26, 2022
@joestringer
Copy link
Member

@aanm can you verify exactly which PRs need to be backported in order to backport this? I hit this issue during backporting, and it's not clear how to resolve it since the files are moving around and I'm unfamiliar with which PRs are doing what when it comes to the robots.txt:

$ cherry-pick  7d30daf013ab0dd86245bca64dd2d438d00d7dca
Applying: 7d30daf013ab add robots.txt to Cilium documentation                                                                  
error: mode change for Documentation/_static/sitemap-index.xml, which is not in current HEAD                                   
error: could not build fake ancestor                                                                                                                                                                                                                           
Patch failed at 0001 add robots.txt to Cilium documentation                                                                                                                                                                                                    
hint: Use 'git am --show-current-patch' to see the failed patch                                                                
When you have resolved this problem, run "git am --continue".                                                                                                                                                                                                  
If you prefer to skip this patch, run "git am --skip" instead.                                                                                                                                                                                                 
To restore the original branch and stop patching, run "git am --abort".

@aanm
Copy link
Member Author

aanm commented Apr 27, 2022

@joestringer this should be the final patch, you can probably get the same patch by doing $ cherry-pick 7d30daf013ab0dd86245bca64dd2d438d00d7dca && git add Documentation/robots/sitemap-index.xml && git cherry-pick --continue

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 6d02febb5d..0aa37c38d1 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -187,6 +187,11 @@ html_theme_options = {
 # so a file named "default.css" will overwrite the builtin "default.css".
 html_static_path = ['images', '_static']
 
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+html_extra_path = ['robots']
+
 # -- Options for HTMLHelp output ------------------------------------------
 
 # Output file base name for HTML help builder.
diff --git a/Documentation/robots/robots.txt b/Documentation/robots/robots.txt
new file mode 100644
index 0000000000..e549b489e9
--- /dev/null
+++ b/Documentation/robots/robots.txt
@@ -0,0 +1,9 @@
+User-agent: *
+
+Disallow: /
+
+Allow: /en/stable
+
+Allow: /en/latest
+
+Sitemap: https://docs.cilium.io/en/latest/sitemap-index.xml
diff --git a/Documentation/robots/sitemap-index.xml b/Documentation/robots/sitemap-index.xml
new file mode 100644
index 0000000000..f040d1ac14
--- /dev/null
+++ b/Documentation/robots/sitemap-index.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
+        xmlns:xhtml="http://www.w3.org/1999/xhtml">
+    <url>
+        <loc>https://docs.cilium.io/en/stable/</loc>
+        <changefreq>daily</changefreq>
+        <priority>1</priority>
+    </url>
+    <url>
+        <loc>https://docs.cilium.io/en/latest/</loc>
+        <changefreq>daily</changefreq>
+        <priority>0.9</priority>
+    </url>
+</urlset>

@aanm aanm added backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. and removed needs-backport/1.11 labels Apr 29, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport done to v1.11 in 1.11.5 Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.11.5
Backport done to v1.11
Development

Successfully merging this pull request may close these issues.

None yet

3 participants