@@ -37,6 +37,7 @@ def generate_title(site_name:, page_title:)
37
37
host : "https://www.example.org" ,
38
38
service_name : "Foo" ,
39
39
full_service_name : "Test Site" ,
40
+ show_govuk_logo : true ,
40
41
)
41
42
42
43
current_page = double ( "current_page" ,
@@ -56,6 +57,31 @@ def generate_title(site_name:, page_title:)
56
57
)
57
58
end
58
59
60
+ it "returns standard meta tag with non GOV.UK twitter image" do
61
+ config = generate_config (
62
+ host : "https://www.example.org" ,
63
+ service_name : "Foo" ,
64
+ full_service_name : "Test Site" ,
65
+ show_govuk_logo : false ,
66
+ )
67
+
68
+ current_page = double ( "current_page" ,
69
+ data : { description : "The description." , title : "The Title" } ,
70
+ url : "/foo.html" ,
71
+ metadata : { locals : { } } )
72
+
73
+ tags = GovukTechDocs ::MetaTags . new ( config , current_page ) . tags
74
+
75
+ expect ( tags ) . to eql (
76
+ "description" => "The description." ,
77
+ "twitter:card" => "summary" ,
78
+ "twitter:domain" => "www.example.org" ,
79
+ "twitter:image" => "https://www.example.org/images/opengraph-image.png" ,
80
+ "twitter:title" => "The Title - Test Site" ,
81
+ "twitter:url" => "https://www.example.org/foo.html" ,
82
+ )
83
+ end
84
+
59
85
it "adds a noindex robots tag when the site config prevents indexing" do
60
86
config = generate_config (
61
87
prevent_indexing : true ,
@@ -128,6 +154,7 @@ def generate_title(site_name:, page_title:)
128
154
host : "https://www.example.org" ,
129
155
service_name : "Foo" ,
130
156
full_service_name : "Test Site" ,
157
+ show_govuk_logo : true ,
131
158
)
132
159
133
160
current_page = double ( "current_page" ,
@@ -147,6 +174,31 @@ def generate_title(site_name:, page_title:)
147
174
)
148
175
end
149
176
177
+ it "returns a custom opengraph meta tag image" do
178
+ config = generate_config (
179
+ host : "https://www.example.org" ,
180
+ service_name : "Foo" ,
181
+ full_service_name : "Test Site" ,
182
+ show_govuk_logo : false ,
183
+ )
184
+
185
+ current_page = double ( "current_page" ,
186
+ data : { description : "The description." , title : "The Title" } ,
187
+ url : "/foo.html" ,
188
+ metadata : { locals : { } } )
189
+
190
+ og_tags = GovukTechDocs ::MetaTags . new ( config , current_page ) . opengraph_tags
191
+
192
+ expect ( og_tags ) . to eql (
193
+ "og:description" => "The description." ,
194
+ "og:image" => "https://www.example.org/images/opengraph-image.png" ,
195
+ "og:site_name" => "Test Site" ,
196
+ "og:title" => "The Title" ,
197
+ "og:type" => "object" ,
198
+ "og:url" => "https://www.example.org/foo.html" ,
199
+ )
200
+ end
201
+
150
202
it "uses the local variable as page title for proxied pages" do
151
203
current_page = double ( "current_page" ,
152
204
data : { description : "The description." } ,
0 commit comments