Sha256: a6dc7796d5432fd59abd80baec711b452c24323d197877c98e5294afd0c937d0
Contents?: true
Size: 931 Bytes
Versions: 5
Compression:
Stored size: 931 Bytes
Contents
module GovukPublishingComponents module Presenters class ArticleSchema attr_reader :page def initialize(page) @page = page end def structured_data # http://schema.org/Article data = CreativeWorkSchema.new(@page).structured_data .merge(body) .merge(search_action) data["@type"] = "Article" data end private # Not all formats have a `body` - some have their content split over # multiple fields. In this case we'll skip the `articleBody` field def body return {} unless page.body.present? { "articleBody" => page.body } end def search_action return {} unless page.document_type == "manual" manuals_facet_params = { manual: page.base_path } PotentialSearchActionSchema.new(manuals_facet_params).structured_data end end end end
Version data entries
5 entries across 5 versions & 1 rubygems