govuk_publishing_components 21.27.1 → 21.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +9 -9
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +17 -2
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +6 -6
- data/app/models/govuk_publishing_components/component_doc.rb +1 -1
- data/app/models/govuk_publishing_components/component_docs.rb +2 -2
- data/app/models/govuk_publishing_components/component_example.rb +4 -4
- data/app/views/govuk_publishing_components/components/_input.html.erb +11 -0
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/docs/button.yml +9 -1
- data/app/views/govuk_publishing_components/components/docs/input.yml +7 -0
- data/config/routes.rb +5 -5
- data/lib/generators/govuk_publishing_components/component_generator.rb +7 -7
- data/lib/govuk_publishing_components.rb +2 -2
- data/lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb +1 -1
- data/lib/govuk_publishing_components/engine.rb +1 -1
- data/lib/govuk_publishing_components/minitest/component_guide_test.rb +4 -4
- data/lib/govuk_publishing_components/presenters/breadcrumbs.rb +9 -9
- data/lib/govuk_publishing_components/presenters/button_helper.rb +20 -10
- data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +2 -2
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_parent.rb +1 -1
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons.rb +3 -3
- data/lib/govuk_publishing_components/presenters/contents_list_helper.rb +5 -5
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +5 -5
- data/lib/govuk_publishing_components/presenters/curated_taxonomy_sidebar_links.rb +5 -5
- data/lib/govuk_publishing_components/presenters/image_card_helper.rb +3 -3
- data/lib/govuk_publishing_components/presenters/machine_readable/article_schema.rb +1 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/creative_work_schema.rb +9 -9
- data/lib/govuk_publishing_components/presenters/machine_readable/dataset_schema.rb +2 -2
- data/lib/govuk_publishing_components/presenters/machine_readable/faq_page_schema.rb +3 -3
- data/lib/govuk_publishing_components/presenters/machine_readable/government_service_schema.rb +10 -10
- data/lib/govuk_publishing_components/presenters/machine_readable/has_part_schema.rb +1 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/is_part_of_schema.rb +1 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/organisation_schema.rb +5 -5
- data/lib/govuk_publishing_components/presenters/machine_readable/person_schema.rb +3 -3
- data/lib/govuk_publishing_components/presenters/machine_readable/potential_search_action_schema.rb +3 -3
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +6 -6
- data/lib/govuk_publishing_components/presenters/organisation_logo_helper.rb +1 -1
- data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +3 -3
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +32 -32
- data/lib/govuk_publishing_components/presenters/schema_org.rb +13 -13
- data/lib/govuk_publishing_components/presenters/select.rb +1 -1
- data/lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb +9 -9
- data/lib/govuk_publishing_components/presenters/taxonomy_list_helper.rb +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/tasks/govuk_publishing_components_tasks.rake +7 -7
- data/node_modules/axe-core/CHANGELOG.md +18 -0
- data/node_modules/axe-core/README.md +9 -6
- data/node_modules/axe-core/axe.js +71 -20
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/bower.json +1 -1
- data/node_modules/axe-core/doc/API.md +4 -7
- data/node_modules/axe-core/doc/backwards-compatibility-doc.md +2 -1
- data/node_modules/axe-core/doc/rule-descriptions.md +129 -91
- data/node_modules/axe-core/lib/checks/aria/invalidrole.js +12 -9
- data/node_modules/axe-core/lib/checks/keyboard/page-has-elm.js +1 -1
- data/node_modules/axe-core/lib/checks/language/has-lang.js +10 -5
- data/node_modules/axe-core/lib/checks/navigation/region.js +7 -2
- data/node_modules/axe-core/lib/commons/aria/index.js +6 -11
- data/node_modules/axe-core/lib/commons/dom/url-props-from-attribute.js +15 -6
- data/node_modules/axe-core/lib/core/utils/get-check-message.js +21 -0
- data/node_modules/axe-core/lib/rules/area-alt.json +2 -0
- data/node_modules/axe-core/lib/rules/aria-roles.json +1 -0
- data/node_modules/axe-core/lib/rules/color-contrast-matches.js +26 -0
- data/node_modules/axe-core/lib/rules/label-content-name-mismatch-matches.js +4 -1
- data/node_modules/axe-core/lib/rules/no-empty-role-matches.js +9 -0
- data/node_modules/axe-core/lib/rules/skip-link-matches.js +1 -1
- data/node_modules/axe-core/package.json +12 -12
- data/node_modules/axe-core/sri-history.json +4 -0
- data/node_modules/govuk-frontend/govuk/all.js +21 -31
- data/node_modules/govuk-frontend/govuk/components/button/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +1 -1
- data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +2 -2
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +20 -30
- data/node_modules/govuk-frontend/govuk/components/tabs/template.njk +2 -2
- data/node_modules/govuk-frontend/govuk/components/tag/_tag.scss +47 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +4 -4
- data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +5 -5
- data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +29 -29
- data/node_modules/govuk-frontend/govuk/overrides/_display.scss +6 -0
- data/node_modules/govuk-frontend/govuk/tools/_iff.scss +3 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +1 -1
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +10 -16
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +10 -14
- data/node_modules/govuk-frontend/package.json +10 -10
- metadata +32 -16
@@ -24,7 +24,7 @@ module GovukPublishingComponents
|
|
24
24
|
@id = options[:id] || "checkboxes-#{SecureRandom.hex(4)}"
|
25
25
|
@heading = options[:heading] || nil
|
26
26
|
@heading_size = options[:heading_size]
|
27
|
-
@heading_size =
|
27
|
+
@heading_size = "m" unless %w(s m l xl).include?(@heading_size)
|
28
28
|
@heading_caption = options[:heading_caption] || nil
|
29
29
|
@is_page_heading = options[:is_page_heading]
|
30
30
|
@description = options[:description] || nil
|
@@ -54,7 +54,7 @@ module GovukPublishingComponents
|
|
54
54
|
if @is_page_heading
|
55
55
|
content_tag(
|
56
56
|
:legend,
|
57
|
-
class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title"
|
57
|
+
class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title",
|
58
58
|
) do
|
59
59
|
concat content_tag(:span, heading_caption, class: "govuk-caption-xl") if heading_caption.present?
|
60
60
|
concat content_tag(:h1, @heading, class: "gem-c-title__text")
|
@@ -11,18 +11,18 @@ module GovukPublishingComponents
|
|
11
11
|
{
|
12
12
|
title: parent.title,
|
13
13
|
url: parent.base_path,
|
14
|
-
is_page_parent: index.zero
|
14
|
+
is_page_parent: index.zero?,
|
15
15
|
}
|
16
16
|
end
|
17
17
|
|
18
18
|
ordered_parents << {
|
19
19
|
title: "Home",
|
20
20
|
url: "/",
|
21
|
-
is_page_parent: ordered_parents.empty
|
21
|
+
is_page_parent: ordered_parents.empty?,
|
22
22
|
}
|
23
23
|
|
24
24
|
{
|
25
|
-
breadcrumbs: ordered_parents.reverse
|
25
|
+
breadcrumbs: ordered_parents.reverse,
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "action_view"
|
2
2
|
|
3
3
|
module GovukPublishingComponents
|
4
4
|
module Presenters
|
@@ -36,7 +36,7 @@ module GovukPublishingComponents
|
|
36
36
|
number = /^\d{1,3}(\.?|\.\d{1,2})(?=\s)/.match(content_item_text)
|
37
37
|
|
38
38
|
if number
|
39
|
-
words = content_item_text.sub(number.to_s,
|
39
|
+
words = content_item_text.sub(number.to_s, "").strip #remove the number from the text
|
40
40
|
content_item_link.sub(content_item_text, "<span class=\"gem-c-contents-list__number\">#{number} </span><span class=\"gem-c-contents-list__numbered-text\">#{words}</span>").squish.html_safe
|
41
41
|
else
|
42
42
|
content_item_link
|
@@ -47,11 +47,11 @@ module GovukPublishingComponents
|
|
47
47
|
|
48
48
|
def parent_modifier
|
49
49
|
if @nested
|
50
|
-
|
50
|
+
"parent"
|
51
51
|
elsif @format_numbers
|
52
|
-
|
52
|
+
"numbered"
|
53
53
|
else
|
54
|
-
|
54
|
+
"dashed"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -8,12 +8,12 @@ module GovukPublishingComponents
|
|
8
8
|
# @param request_path `request.path`
|
9
9
|
def initialize(content_item, request)
|
10
10
|
@content_item = content_item
|
11
|
-
@request_path = simple_smart_answer? ? content_item[
|
11
|
+
@request_path = simple_smart_answer? ? content_item["base_path"] : request.path
|
12
12
|
@query_parameters = request.query_parameters
|
13
13
|
end
|
14
14
|
|
15
15
|
def simple_smart_answer?
|
16
|
-
content_item[
|
16
|
+
content_item["document_type"] === "simple_smart_answer"
|
17
17
|
end
|
18
18
|
|
19
19
|
def taxon_breadcrumbs
|
@@ -31,9 +31,9 @@ module GovukPublishingComponents
|
|
31
31
|
url: "/",
|
32
32
|
},
|
33
33
|
{
|
34
|
-
title: parent_finder[
|
35
|
-
url: parent_finder[
|
36
|
-
}
|
34
|
+
title: parent_finder["title"],
|
35
|
+
url: parent_finder["base_path"],
|
36
|
+
},
|
37
37
|
]
|
38
38
|
else
|
39
39
|
ContentBreadcrumbsBasedOnParent.new(content_item).breadcrumbs[:breadcrumbs]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "set"
|
2
2
|
|
3
3
|
module GovukPublishingComponents
|
4
4
|
module Presenters
|
@@ -34,7 +34,7 @@ module GovukPublishingComponents
|
|
34
34
|
|
35
35
|
[
|
36
36
|
{
|
37
|
-
title:
|
37
|
+
title: "Elsewhere on GOV.UK",
|
38
38
|
related_content: format_for_sidebar(elsewhere_items),
|
39
39
|
},
|
40
40
|
]
|
@@ -45,14 +45,14 @@ module GovukPublishingComponents
|
|
45
45
|
|
46
46
|
external_links = @content_item.external_links.map do |link|
|
47
47
|
{
|
48
|
-
title: link[
|
49
|
-
link: link[
|
48
|
+
title: link["title"],
|
49
|
+
link: link["url"],
|
50
50
|
}
|
51
51
|
end
|
52
52
|
|
53
53
|
[
|
54
54
|
{
|
55
|
-
title:
|
55
|
+
title: "Elsewhere on the web",
|
56
56
|
related_content: external_links,
|
57
57
|
},
|
58
58
|
]
|
@@ -42,10 +42,10 @@ module GovukPublishingComponents
|
|
42
42
|
def context
|
43
43
|
return unless @context
|
44
44
|
|
45
|
-
content_tag(:p, class:
|
45
|
+
content_tag(:p, class: "gem-c-image-card__context") do
|
46
46
|
if @context[:date]
|
47
|
-
date = content_tag(:time, l(@context[:date], format:
|
48
|
-
dash = content_tag(:span,
|
47
|
+
date = content_tag(:time, l(@context[:date], format: "%e %B %Y"), datetime: @context[:date].iso8601)
|
48
|
+
dash = content_tag(:span, " — ", 'aria-hidden': true)
|
49
49
|
|
50
50
|
if @context[:text]
|
51
51
|
date.concat(dash).concat(@context[:text])
|
@@ -28,8 +28,8 @@ module GovukPublishingComponents
|
|
28
28
|
"logo" => {
|
29
29
|
"@type" => "ImageObject",
|
30
30
|
"url" => page.logo_url,
|
31
|
-
}
|
32
|
-
}
|
31
|
+
},
|
32
|
+
},
|
33
33
|
}.merge(image_schema).merge(author_schema).merge(is_part_of).merge(about).merge(has_part)
|
34
34
|
end
|
35
35
|
|
@@ -39,7 +39,7 @@ module GovukPublishingComponents
|
|
39
39
|
|
40
40
|
def image_schema
|
41
41
|
{
|
42
|
-
"image" => page.has_image? ? [page.image_url] : page.image_placeholders
|
42
|
+
"image" => page.has_image? ? [page.image_url] : page.image_placeholders,
|
43
43
|
}
|
44
44
|
end
|
45
45
|
|
@@ -51,7 +51,7 @@ module GovukPublishingComponents
|
|
51
51
|
"@type" => "Organization",
|
52
52
|
"name" => publishing_organisation["title"],
|
53
53
|
"url" => Plek.current.website_root + publishing_organisation["base_path"],
|
54
|
-
}
|
54
|
+
},
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
@@ -63,7 +63,7 @@ module GovukPublishingComponents
|
|
63
63
|
return {} unless document_collections.any?
|
64
64
|
|
65
65
|
{
|
66
|
-
"isPartOf" => document_collections
|
66
|
+
"isPartOf" => document_collections,
|
67
67
|
}
|
68
68
|
end
|
69
69
|
|
@@ -72,7 +72,7 @@ module GovukPublishingComponents
|
|
72
72
|
content_item: step_by_step,
|
73
73
|
schema: :article,
|
74
74
|
logo_url: page.logo_url,
|
75
|
-
image_placeholders: page.image_placeholders
|
75
|
+
image_placeholders: page.image_placeholders,
|
76
76
|
)
|
77
77
|
end
|
78
78
|
|
@@ -80,7 +80,7 @@ module GovukPublishingComponents
|
|
80
80
|
return {} unless collection_pages("documents").any?
|
81
81
|
|
82
82
|
{
|
83
|
-
"hasPart" => collection_pages("documents").map { |document| HasPartSchema.new(document).structured_data }
|
83
|
+
"hasPart" => collection_pages("documents").map { |document| HasPartSchema.new(document).structured_data },
|
84
84
|
}
|
85
85
|
end
|
86
86
|
|
@@ -101,7 +101,7 @@ module GovukPublishingComponents
|
|
101
101
|
return {} unless live_taxons.any?
|
102
102
|
|
103
103
|
{
|
104
|
-
"about" => linked_taxons
|
104
|
+
"about" => linked_taxons,
|
105
105
|
}
|
106
106
|
end
|
107
107
|
|
@@ -117,7 +117,7 @@ module GovukPublishingComponents
|
|
117
117
|
{
|
118
118
|
"@context" => "http://schema.org",
|
119
119
|
"@type" => "Thing",
|
120
|
-
"sameAs" => taxon["web_url"]
|
120
|
+
"sameAs" => taxon["web_url"],
|
121
121
|
}
|
122
122
|
end
|
123
123
|
end
|
@@ -20,13 +20,13 @@ module GovukPublishingComponents
|
|
20
20
|
|
21
21
|
def description
|
22
22
|
{
|
23
|
-
"description" => (page.body || page.description).slice(0..4999)
|
23
|
+
"description" => (page.body || page.description).slice(0..4999),
|
24
24
|
}
|
25
25
|
end
|
26
26
|
|
27
27
|
def name
|
28
28
|
{
|
29
|
-
"name" => page.title
|
29
|
+
"name" => page.title,
|
30
30
|
}
|
31
31
|
end
|
32
32
|
end
|
@@ -19,7 +19,7 @@ module GovukPublishingComponents
|
|
19
19
|
|
20
20
|
def main_entity
|
21
21
|
{
|
22
|
-
"mainEntity" => questions_and_answers_markup
|
22
|
+
"mainEntity" => questions_and_answers_markup,
|
23
23
|
}
|
24
24
|
end
|
25
25
|
|
@@ -36,8 +36,8 @@ module GovukPublishingComponents
|
|
36
36
|
"acceptedAnswer" => {
|
37
37
|
"@type" => "Answer",
|
38
38
|
"url" => q_and_a_url,
|
39
|
-
"text" => value[:answer]
|
40
|
-
}
|
39
|
+
"text" => value[:answer],
|
40
|
+
},
|
41
41
|
}
|
42
42
|
end
|
43
43
|
end
|
data/lib/govuk_publishing_components/presenters/machine_readable/government_service_schema.rb
CHANGED
@@ -14,7 +14,7 @@ module GovukPublishingComponents
|
|
14
14
|
"@type" => "GovernmentService",
|
15
15
|
"name" => page.title,
|
16
16
|
"description" => page.description,
|
17
|
-
"url" => page.canonical_url
|
17
|
+
"url" => page.canonical_url,
|
18
18
|
}
|
19
19
|
.merge(provider)
|
20
20
|
.merge(related_services)
|
@@ -23,38 +23,38 @@ module GovukPublishingComponents
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def related_services
|
26
|
-
related_links = page.content_item.dig(
|
26
|
+
related_links = page.content_item.dig("links", "ordered_related_items")
|
27
27
|
|
28
28
|
return {} unless related_links.present?
|
29
29
|
|
30
30
|
{
|
31
31
|
"isRelatedTo" => related_links.each_with_object([]) do |link, items|
|
32
|
-
if link[
|
32
|
+
if link["schema_name"] == "transaction"
|
33
33
|
items << {
|
34
34
|
"@type" => "GovernmentService",
|
35
|
-
"name" => link[
|
36
|
-
"url" => link[
|
35
|
+
"name" => link["title"],
|
36
|
+
"url" => link["web_url"],
|
37
37
|
}
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end,
|
40
40
|
}
|
41
41
|
end
|
42
42
|
|
43
43
|
def provider
|
44
|
-
organisations = page.content_item.dig(
|
44
|
+
organisations = page.content_item.dig("links", "organisations")
|
45
45
|
|
46
46
|
return {} unless organisations.present?
|
47
47
|
|
48
48
|
providers = organisations.map do |organisation|
|
49
49
|
{
|
50
50
|
"@type" => "GovernmentOrganization",
|
51
|
-
"name" => organisation[
|
52
|
-
"url" => organisation[
|
51
|
+
"name" => organisation["title"],
|
52
|
+
"url" => organisation["web_url"],
|
53
53
|
}
|
54
54
|
end
|
55
55
|
|
56
56
|
{
|
57
|
-
"provider" => providers
|
57
|
+
"provider" => providers,
|
58
58
|
}
|
59
59
|
end
|
60
60
|
end
|
@@ -35,7 +35,7 @@ module GovukPublishingComponents
|
|
35
35
|
end
|
36
36
|
|
37
37
|
{
|
38
|
-
"member" => members
|
38
|
+
"member" => members,
|
39
39
|
}
|
40
40
|
end
|
41
41
|
|
@@ -62,7 +62,7 @@ module GovukPublishingComponents
|
|
62
62
|
"honorificPrefix" => minister["name_prefix"],
|
63
63
|
"image" => minister.dig("image", "url"),
|
64
64
|
"name" => minister["name"],
|
65
|
-
"url" => minister_url(minister)
|
65
|
+
"url" => minister_url(minister),
|
66
66
|
}
|
67
67
|
end
|
68
68
|
|
@@ -72,7 +72,7 @@ module GovukPublishingComponents
|
|
72
72
|
{
|
73
73
|
"@type" => "Role",
|
74
74
|
"name" => minister["role"],
|
75
|
-
"url" => role_url(minister)
|
75
|
+
"url" => role_url(minister),
|
76
76
|
}
|
77
77
|
end
|
78
78
|
|
@@ -107,7 +107,7 @@ module GovukPublishingComponents
|
|
107
107
|
end
|
108
108
|
|
109
109
|
{
|
110
|
-
schema_name => related_orgs
|
110
|
+
schema_name => related_orgs,
|
111
111
|
}
|
112
112
|
end
|
113
113
|
|
@@ -115,7 +115,7 @@ module GovukPublishingComponents
|
|
115
115
|
{
|
116
116
|
"@context" => "http://schema.org",
|
117
117
|
"@type" => "GovernmentOrganization",
|
118
|
-
"sameAs" => url
|
118
|
+
"sameAs" => url,
|
119
119
|
}
|
120
120
|
end
|
121
121
|
|
@@ -17,7 +17,7 @@ module GovukPublishingComponents
|
|
17
17
|
"@id" => page.canonical_url,
|
18
18
|
},
|
19
19
|
"name" => page.title,
|
20
|
-
"description" => page.body
|
20
|
+
"description" => page.body,
|
21
21
|
}.merge(image_schema)
|
22
22
|
end
|
23
23
|
|
@@ -30,8 +30,8 @@ module GovukPublishingComponents
|
|
30
30
|
|
31
31
|
{
|
32
32
|
"image" => [
|
33
|
-
page.image_url
|
34
|
-
]
|
33
|
+
page.image_url,
|
34
|
+
],
|
35
35
|
}
|
36
36
|
end
|
37
37
|
end
|
data/lib/govuk_publishing_components/presenters/machine_readable/potential_search_action_schema.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "plek"
|
2
2
|
|
3
3
|
module GovukPublishingComponents
|
4
4
|
module Presenters
|
@@ -19,8 +19,8 @@ module GovukPublishingComponents
|
|
19
19
|
"@type": "SearchAction",
|
20
20
|
"description": description,
|
21
21
|
"target": search_template,
|
22
|
-
"query": "required"
|
23
|
-
}
|
22
|
+
"query": "required",
|
23
|
+
},
|
24
24
|
}
|
25
25
|
end
|
26
26
|
|
@@ -70,9 +70,9 @@ module GovukPublishingComponents
|
|
70
70
|
|
71
71
|
def add_taxonomy_tags(meta_tags)
|
72
72
|
themes = root_taxon_slugs(content_item)
|
73
|
-
meta_tags["govuk:themes"] = themes.to_a.sort.join(
|
73
|
+
meta_tags["govuk:themes"] = themes.to_a.sort.join(", ") unless themes.empty?
|
74
74
|
|
75
|
-
taxons = if content_item[:document_type] ==
|
75
|
+
taxons = if content_item[:document_type] == "taxon"
|
76
76
|
[content_item]
|
77
77
|
else
|
78
78
|
links[:taxons] || []
|
@@ -84,14 +84,14 @@ module GovukPublishingComponents
|
|
84
84
|
slug_without_theme = base_path[%r{/[^/]+/(.+)}, 1]
|
85
85
|
# Return the slug without the theme, or in the special case of a root taxon,
|
86
86
|
# just return the full slug (because it doesn't have a slug beneath the theme)
|
87
|
-
slug_without_theme || base_path.sub(%r(^/),
|
87
|
+
slug_without_theme || base_path.sub(%r(^/), "")
|
88
88
|
end
|
89
89
|
taxon_ids = taxons.map { |taxon| taxon[:content_id] }
|
90
90
|
|
91
91
|
meta_tags["govuk:taxon-id"] = taxon_ids.first unless taxon_ids.empty?
|
92
|
-
meta_tags["govuk:taxon-ids"] = taxon_ids.join(
|
92
|
+
meta_tags["govuk:taxon-ids"] = taxon_ids.join(",") unless taxon_ids.empty?
|
93
93
|
meta_tags["govuk:taxon-slug"] = taxon_slugs_without_theme.first unless taxon_slugs_without_theme.empty?
|
94
|
-
meta_tags["govuk:taxon-slugs"] = taxon_slugs_without_theme.join(
|
94
|
+
meta_tags["govuk:taxon-slugs"] = taxon_slugs_without_theme.join(",") unless taxon_slugs_without_theme.empty?
|
95
95
|
meta_tags
|
96
96
|
end
|
97
97
|
|
@@ -123,7 +123,7 @@ module GovukPublishingComponents
|
|
123
123
|
parent_taxons = links[:parent_taxons] || links[:taxons] unless links.nil?
|
124
124
|
|
125
125
|
if parent_taxons.blank?
|
126
|
-
root_taxon_set << content_item[:base_path].sub(%r(^/),
|
126
|
+
root_taxon_set << content_item[:base_path].sub(%r(^/), "") if content_item[:document_type] == "taxon"
|
127
127
|
else
|
128
128
|
parent_taxons.each do |parent_taxon|
|
129
129
|
root_taxon_set += root_taxon_slugs(parent_taxon)
|