Skip to content

Commit

Permalink
Return sitemap on robots.txt file
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Feb 12, 2019
1 parent 3de35d0 commit ab64878
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion readthedocs/core/views/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,14 @@ def robots_txt(request, project):
if os.path.exists(fullpath):
return HttpResponse(open(fullpath).read(), content_type='text/plain')

return HttpResponse('User-agent: *\nAllow: /\n', content_type='text/plain')
sitemap_url = '{scheme}://{domain}/sitemap.xml'.format(
scheme='https',
domain=project.subdomain(),
)
return HttpResponse(
'User-agent: *\nAllow: /\nSitemap: {}\n'.format(sitemap_url),
content_type='text/plain',
)


@map_project_slug
Expand Down

0 comments on commit ab64878

Please sign in to comment.