File tree 3 files changed +39
-2
lines changed
3 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,16 @@ def dataset?
26
26
%(national_statistics official_statistics transparency) . include? document_type
27
27
end
28
28
29
- # this is a temporary hack and should be removed in approx 3 months
30
29
def hide_from_search_engines?
31
- content_item [ "base_path" ] == "/government/publications/pension-credit-claim-form--2"
30
+ # this is a temporary hack and should be removed in approx 3 months
31
+ return true if content_item [ "base_path" ] == "/government/publications/pension-credit-claim-form--2"
32
+
33
+ mobile_paths = %w[
34
+ /government/publications/govuk-app-terms-and-conditions
35
+ /government/publications/govuk-app-privacy-notice-how-we-use-your-data
36
+ /government/publications/govuk-app-test-privacy-notice-how-we-use-your-data
37
+ /government/publications/accessibility-statement-for-the-govuk-append
38
+ ]
39
+ mobile_paths . include? ( content_item [ "base_path" ] )
32
40
end
33
41
end
Original file line number Diff line number Diff line change @@ -300,6 +300,20 @@ class PublicationTest < ActionDispatch::IntegrationTest
300
300
assert page . has_css? ( 'meta[name="robots"][content="noindex"]' , visible : false )
301
301
end
302
302
303
+ test "adds the noindex meta tag to mobile paths" do
304
+ mobile_paths = %w[
305
+ /government/publications/govuk-app-terms-and-conditions
306
+ /government/publications/govuk-app-privacy-notice-how-we-use-your-data
307
+ /government/publications/govuk-app-test-privacy-notice-how-we-use-your-data
308
+ /government/publications/accessibility-statement-for-the-govuk-append
309
+ ]
310
+ mobile_paths . each do |path |
311
+ overrides = { "base_path" => path }
312
+ setup_and_visit_content_item ( "publication-with-featured-attachments" , overrides )
313
+ assert page . has_css? ( 'meta[name="robots"][content="noindex"]' , visible : false )
314
+ end
315
+ end
316
+
303
317
test "translates Welsh published date correctly" do
304
318
setup_and_visit_content_item ( "publication" , { "locale" => "cy" } )
305
319
Original file line number Diff line number Diff line change @@ -101,4 +101,19 @@ def schema_name
101
101
102
102
assert presented . hide_from_search_engines?
103
103
end
104
+
105
+ test "hide_from_search_engines? returns true if the page is related to mobile" do
106
+ schema_example = schema_item ( "publication-with-featured-attachments" )
107
+ mobile_paths = %w[
108
+ /government/publications/govuk-app-terms-and-conditions
109
+ /government/publications/govuk-app-privacy-notice-how-we-use-your-data
110
+ /government/publications/govuk-app-test-privacy-notice-how-we-use-your-data
111
+ /government/publications/accessibility-statement-for-the-govuk-append
112
+ ]
113
+ mobile_paths . each do |path |
114
+ schema_example [ "base_path" ] = path
115
+ presented = presented_item ( "publication" , schema_example )
116
+ assert presented . hide_from_search_engines?
117
+ end
118
+ end
104
119
end
You can’t perform that action at this time.
0 commit comments