Skip to content

Commit

Permalink
Extract rest of tags to core_tags
Browse files Browse the repository at this point in the history
  • Loading branch information
tijmenb committed Apr 24, 2018
1 parent 97a3dd6 commit 2e1d209
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions lib/govuk_publishing_components/presenters/meta_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,11 @@ def initialize(content_item, local_assigns)

def meta_tags
meta_tags = {}

meta_tags = add_document_type_tags(meta_tags)

meta_tags["govuk:content-id"] = content_item[:content_id] if content_item[:content_id]
meta_tags["govuk:withdrawn"] = "withdrawn" if content_item[:withdrawn_notice].present?

meta_tags = add_core_tags(meta_tags)
meta_tags = add_organisation_tags(meta_tags)
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?

meta_tags["govuk:static-analytics:strip-postcodes"] = "true" if should_strip_postcode_pii?(content_item, local_assigns)

meta_tags = add_step_by_step_tags(meta_tags)

meta_tags
end

Expand Down Expand Up @@ -105,7 +94,7 @@ def add_step_by_step_tags(meta_tags)
meta_tags
end

def add_document_type_tags(meta_tags)
def add_core_tags(meta_tags)
meta_tags["govuk:format"] = content_item[:document_type] if content_item[:document_type]
meta_tags["govuk:schema-name"] = content_item[:schema_name] if content_item[:schema_name]

Expand All @@ -115,6 +104,11 @@ def add_document_type_tags(meta_tags)
navigation_document_type = content_item[:navigation_document_supertype]
meta_tags["govuk:navigation-document-type"] = navigation_document_type if navigation_document_type

meta_tags["govuk:content-id"] = content_item[:content_id] if content_item[:content_id]
meta_tags["govuk:withdrawn"] = "withdrawn" if content_item[:withdrawn_notice].present?
meta_tags["govuk:content-has-history"] = "true" if has_content_history?
meta_tags["govuk:static-analytics:strip-postcodes"] = "true" if should_strip_postcode_pii?(content_item, local_assigns)

meta_tags
end

Expand Down

0 comments on commit 2e1d209

Please sign in to comment.