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

[DOCS] Add proper robots.txt and sitemap.xml to index only latest and stable #1752

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/source/_html/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
User-agent: *

# Allow crawling of all paths
Allow: /

# Override to disallow crawling of documentation
Disallow: /projects/docs/

# Override again to allow crawling of /latest documentation
Allow: /projects/docs/en/latest/

# Override again to allow crawling of /stable documentation
Allow: /projects/docs/en/stable/

# Custom sitemap
Sitemap: https://www.getdaft.io/sitemap-override.xml
19 changes: 19 additions & 0 deletions docs/source/_html/sitemap-override.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THe only issue is that we use the getdaft.io domain for other things too besides the docs https://www.getdaft.io/
the current sitemap in this PR would prevent that stuff from getting indexed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.getdaft.io/projects/docs/en/latest/</loc>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
<url>
<loc>https://www.getdaft.io/projects/docs/en/stable/</loc>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://www.getdaft.io/</loc>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
3 changes: 3 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
"learn/10-min": "../10-min.html",
}

# Adds /_html folder which serves robots.txt and the sitemap
html_extra_path = ["_html"]

# Resolving code links to github
# Adapted from: https://github.com/aaugustin/websockets/blob/778a1ca6936ac67e7a3fe1bbe585db2eafeaa515/docs/conf.py#L100-L134

Expand Down
Loading