diff --git a/akvo/templates/robots/dev-robots.txt b/akvo/templates/robots/dev-robots.txt new file mode 100644 index 0000000000..77470cb39f --- /dev/null +++ b/akvo/templates/robots/dev-robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file diff --git a/akvo/templates/robots/live-robots.txt b/akvo/templates/robots/live-robots.txt new file mode 100644 index 0000000000..14267e9032 --- /dev/null +++ b/akvo/templates/robots/live-robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Allow: / \ No newline at end of file diff --git a/akvo/urls.py b/akvo/urls.py index bbddcd31de..bcf8e6f4e1 100644 --- a/akvo/urls.py +++ b/akvo/urls.py @@ -263,3 +263,18 @@ if settings.REQUIRED_AUTH_GROUPS: check_auth_groups(settings.REQUIRED_AUTH_GROUPS) + + +# Robots.txt +if settings.DEBUG: + urlpatterns += patterns( + '', + url(r'^robots\.txt$', + TemplateView.as_view(template_name='robots/dev-robots.txt', content_type='text/plain')) + ) +else: + urlpatterns += patterns( + '', + url(r'^robots\.txt$', + TemplateView.as_view(template_name='robots/live-robots.txt', content_type='text/plain')) + )