Skip to content

Commit

Permalink
Extract add_political_tags
Browse files Browse the repository at this point in the history
  • Loading branch information
tijmenb committed Apr 24, 2018
1 parent a614146 commit 97a3dd6
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions lib/govuk_publishing_components/presenters/meta_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@ def meta_tags
meta_tags["govuk:withdrawn"] = "withdrawn" if content_item[:withdrawn_notice].present?

meta_tags = add_organisation_tags(meta_tags)

if details.key?(:political) && details.key?(:government)
political_status = "non-political"
if details[:political]
political_status = details[:government][:current] ? "political" : "historic"
end

meta_tags["govuk:political-status"] = political_status
meta_tags["govuk:publishing-government"] = details[:government][:slug]
end

meta_tags = add_political_tags(meta_tags)
meta_tags = add_taxonomy_tags(meta_tags)

meta_tags["govuk:content-has-history"] = "true" if has_content_history?
Expand Down Expand Up @@ -141,6 +131,20 @@ def add_organisation_tags(meta_tags)

meta_tags
end

def add_political_tags(meta_tags)
if details.key?(:political) && details.key?(:government)
political_status = "non-political"
if details[:political]
political_status = details[:government][:current] ? "political" : "historic"
end

meta_tags["govuk:political-status"] = political_status
meta_tags["govuk:publishing-government"] = details[:government][:slug]
end

meta_tags
end
end
end
end

0 comments on commit 97a3dd6

Please sign in to comment.