Skip to content

Commit

Permalink
Add robots.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
znick committed Mar 30, 2024
1 parent a3207db commit 485ac71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions anytask/index/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from django.shortcuts import render
from schools.models import School

ROBOTS_TXT = """User-agent: *
Allow: /
Clean-param: next /accounts/login/
"""

def index(request):
schools = School.objects.all().filter(is_active=True).order_by('name')
Expand All @@ -24,3 +28,7 @@ def archive_index(request):
}

return render(request, 'archived_schools_page.html', context)


def robotstxt_view(request):
return HttpResponse(ROBOTS_TXT, content_type="text/plain")
1 change: 1 addition & 0 deletions anytask/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@
url(r'^jupyter/', include('jupyter.urls')),
url(r'^set_lang/', set_lang_view, name='set_lang'),
url(r'^get_lang/', get_lang_view, name='get_lang'),
url(r'^$', index.views.index, name="index.views.robotstxt_view"),
]

0 comments on commit 485ac71

Please sign in to comment.