On rajoute <meta name="robots" content="noindex"> sur toutes les pages sauf la page d'accueil

This commit is contained in:
Tom Hubrecht 2021-02-28 11:45:23 +01:00
parent 846a7548d1
commit d5238314e6
2 changed files with 4 additions and 0 deletions

View file

@ -6,6 +6,7 @@
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8"> <meta charset="UTF-8">
{% if no_crawlers %}<meta name="robots" content="noindex">{% endif %}
<title> <title>
{% block title_onglet %}{% trans "Annuaire des élèves de l'ENS" %}{% endblock %} {% block title_onglet %}{% trans "Annuaire des élèves de l'ENS" %}{% endblock %}
</title> </title>

View file

@ -30,6 +30,7 @@ from fiches.models import Address, Mail, Phone, Profile, Social
class FicheView(DetailView): class FicheView(DetailView):
model = Profile model = Profile
template_name = "fiches/fiche.html" template_name = "fiches/fiche.html"
extra_context = {"no_crawlers": True}
def get_object(self): def get_object(self):
return get_object_or_404(Profile, user__username=self.kwargs.get("user")) return get_object_or_404(Profile, user__username=self.kwargs.get("user"))
@ -40,6 +41,7 @@ class EditView(UpdateView):
template_name = "fiches/fiches_modif.html" template_name = "fiches/fiches_modif.html"
model = Profile model = Profile
form_class = ProfileForm form_class = ProfileForm
extra_context = {"no_crawlers": True}
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.object = self.get_object() self.object = self.get_object()
@ -141,6 +143,7 @@ class HomeView(FormView):
class BirthdayView(ListView): class BirthdayView(ListView):
model = Profile model = Profile
template_name = "fiches/birthday.html" template_name = "fiches/birthday.html"
extra_context = {"no_crawlers": True}
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)