From 4f82ba7f655c4251bfc7657d7979ba1d81a15dfb Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Fri, 13 Sep 2024 09:41:45 +0100 Subject: [PATCH] Remove 'analytics' from metatags - to make this consistent with other metatags --- CHANGELOG.md | 4 ++++ lib/slimmer/processors/metadata_inserter.rb | 3 +++ test/processors/metadata_inserter_test.rb | 8 ++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 324b720f..793d2892 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# Unreleased + +* Remove 'analytics' from metatags + # 18.6.1 * Update body classes for govuk-frontend-v5 diff --git a/lib/slimmer/processors/metadata_inserter.rb b/lib/slimmer/processors/metadata_inserter.rb index ce427720..7c486452 100644 --- a/lib/slimmer/processors/metadata_inserter.rb +++ b/lib/slimmer/processors/metadata_inserter.rb @@ -8,8 +8,11 @@ def initialize(response, app_name) def filter(_old_doc, new_doc) head = new_doc.at_css("head") + # temporarily duplicate these tags with the old names to avoid deployment issues add_meta_tag("analytics:organisations", @headers[Slimmer::Headers::ORGANISATIONS_HEADER], head, new_doc) add_meta_tag("analytics:world-locations", @headers[Slimmer::Headers::WORLD_LOCATIONS_HEADER], head, new_doc) + add_meta_tag("organisations", @headers[Slimmer::Headers::ORGANISATIONS_HEADER], head, new_doc) + add_meta_tag("world-locations", @headers[Slimmer::Headers::WORLD_LOCATIONS_HEADER], head, new_doc) add_meta_tag("format", @headers[Slimmer::Headers::FORMAT_HEADER], head, new_doc) add_meta_tag("search-result-count", @headers[Slimmer::Headers::RESULT_COUNT_HEADER], head, new_doc) add_meta_tag("rendering-application", @app_name, head, new_doc) diff --git a/test/processors/metadata_inserter_test.rb b/test/processors/metadata_inserter_test.rb index 1eec7575..aa8d6ddd 100644 --- a/test/processors/metadata_inserter_test.rb +++ b/test/processors/metadata_inserter_test.rb @@ -45,11 +45,11 @@ def test_should_include_format_meta_tag end def test_should_include_organisations_meta_tag - assert_meta_tag "analytics:organisations", "" + assert_meta_tag "organisations", "" end def test_should_include_world_locations_meta_tag - assert_meta_tag "analytics:world-locations", "" + assert_meta_tag "world-locations", "" end def test_should_include_search_result_count_meta_tag @@ -71,11 +71,11 @@ def test_should_omit_internal_format_name end def test_should_omit_organisations - refute_meta_tag "analytics:organisations" + refute_meta_tag "organisations" end def test_should_omit_world_locations - refute_meta_tag "analytics:world-locations" + refute_meta_tag "world-locations" end def test_should_omit_result_count