Class: GovukPublishingComponents::Presenters::NewsArticleSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk_publishing_components/presenters/machine_readable/news_article_schema.rb

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ NewsArticleSchema

Returns a new instance of NewsArticleSchema.



4
5
6
# File 'lib/govuk_publishing_components/presenters/machine_readable/news_article_schema.rb', line 4

def initialize(page)
  @page = page
end

Instance Method Details

#structured_dataObject



8
9
10
11
12
13
# File 'lib/govuk_publishing_components/presenters/machine_readable/news_article_schema.rb', line 8

def structured_data
  # http://schema.org/NewsArticle
  data = ArticleSchema.new(@page).structured_data
  data["@type"] = "NewsArticle"
  data
end