Skip to content

Commit

Permalink
Add noindex meta tag on non-current person page
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljcollinsuk committed Feb 2, 2021
1 parent aacbeb5 commit da521ed
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
{% block og_description %}{% include "people/includes/_person_meta_description.html" %}{% endblock og_description %}
{% block og_image %}{% if object.photo_url %}{{ object.photo_url }}{% endif %}{% endblock og_image %}

{% block page_meta %}<meta name="robots" content="noindex">{% endblock page_meta %}

{% block content %}
<div class="card person_banner">
<h2 class="person_name">{{ object.name }}
Expand Down
4 changes: 4 additions & 0 deletions wcivf/apps/people/tests/test_person_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def test_current_person_view(self):
response = self.client.get(self.person_url, follow=True)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "people/person_detail.html")
self.assertNotContains(
response, '<meta name="robots" content="noindex">'
)

def test_not_current_person_view(self):
response = self.client.get(self.person_url, follow=True)
Expand All @@ -35,6 +38,7 @@ def test_not_current_person_view(self):
)
self.assertContains(response, "Previous elections")
self.assertNotContains(response, "Contact information")
self.assertContains(response, '<meta name="robots" content="noindex">')

def test_correct_elections_listed(self):
response = self.client.get(self.person_url, follow=True)
Expand Down
1 change: 0 additions & 1 deletion wcivf/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{% load pipeline %}
{% load static %}


{% block site_meta %}
<title>
{% block base_title %}
Expand Down

0 comments on commit da521ed

Please sign in to comment.