From f902205ef380da595cd38774a9f00c74667b19ff Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 26 May 2020 17:45:55 +0100 Subject: [PATCH] Remove email features page from search engines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reimplements https://github.com/alphagov/notifications-aws/pull/796 Since deploying alphagov/notifications-utils#736 I’ve been looking at how members of the public are ending up on our support page. The vast majority are landing on https://www.notifications.service.gov.uk/features/email Previously we thought that they were clicking the ‘contact us’ link in the page, which deep linked into the support journey, so we removed these deep links in alphagov/notifications-admin#3451 But the tickets are still coming in, so I think that people are still landing on this page, then going directly to ‘support’ in the top navigation. So the next measure we have available is to try to stop people from landing on this page in the first place. All the examples I’ve looked at show people coming from Google to this page. By putting the page’s URL in our robots.txt it should stop Google (and other search engines) listing it in search results. --- app/main/views/index.py | 3 ++- tests/app/main/views/test_index.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/main/views/index.py b/app/main/views/index.py index 4ed477e70..a36fdd133 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -21,7 +21,7 @@ from app.main.views.sub_navigation_dictionaries import ( using_notify_nav, ) from app.models.feedback import QUESTION_TICKET_TYPE -from app.utils import get_logo_cdn_domain +from app.utils import get_logo_cdn_domain, hide_from_search_engines @main.route('/') @@ -253,6 +253,7 @@ def roadmap(): @main.route('/features/email') +@hide_from_search_engines def features_email(): return render_template( 'views/features/emails.html', diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index 6bc322b44..7dc94201a 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -88,6 +88,7 @@ def test_robots(client): ('bat_phone', {}), ('thanks', {}), ('register', {}), + ('features_email', {}), pytest.param('index', {}, marks=pytest.mark.xfail(raises=AssertionError)), )) @freeze_time('2012-12-12 12:12') # So we don’t go out of business hours