Class: BetterSeo::StructuredData::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/better_seo/structured_data/generator.rb

Class Method Summary collapse

Class Method Details

.article(**properties) {|article| ... } ⇒ Object

Yields:



19
20
21
22
23
# File 'lib/better_seo/structured_data/generator.rb', line 19

def article(**properties)
  article = Article.new(**properties)
  yield(article) if block_given?
  article
end

Yields:

  • (breadcrumb)


37
38
39
40
41
# File 'lib/better_seo/structured_data/generator.rb', line 37

def breadcrumb_list(**properties)
  breadcrumb = BreadcrumbList.new(**properties)
  yield(breadcrumb) if block_given?
  breadcrumb
end

.event(**properties) {|event| ... } ⇒ Object

Yields:



49
50
51
52
53
# File 'lib/better_seo/structured_data/generator.rb', line 49

def event(**properties)
  event = Event.new(**properties)
  yield(event) if block_given?
  event
end

.faq_page(**properties) {|faq| ... } ⇒ Object

Yields:

  • (faq)


55
56
57
58
59
# File 'lib/better_seo/structured_data/generator.rb', line 55

def faq_page(**properties)
  faq = FAQPage.new(**properties)
  yield(faq) if block_given?
  faq
end

.generate_script_tags(structured_data_array) ⇒ Object



7
8
9
10
11
# File 'lib/better_seo/structured_data/generator.rb', line 7

def generate_script_tags(structured_data_array)
  return "" if structured_data_array.empty?

  structured_data_array.map(&:to_script_tag).join("\n\n")
end

.how_to(**properties) {|how_to| ... } ⇒ Object

Yields:



61
62
63
64
65
# File 'lib/better_seo/structured_data/generator.rb', line 61

def how_to(**properties)
  how_to = HowTo.new(**properties)
  yield(how_to) if block_given?
  how_to
end

.local_business(**properties) {|business| ... } ⇒ Object

Yields:

  • (business)


43
44
45
46
47
# File 'lib/better_seo/structured_data/generator.rb', line 43

def local_business(**properties)
  business = LocalBusiness.new(**properties)
  yield(business) if block_given?
  business
end

.organization(**properties) {|org| ... } ⇒ Object

Yields:

  • (org)


13
14
15
16
17
# File 'lib/better_seo/structured_data/generator.rb', line 13

def organization(**properties)
  org = Organization.new(**properties)
  yield(org) if block_given?
  org
end

.person(**properties) {|person| ... } ⇒ Object

Yields:



25
26
27
28
29
# File 'lib/better_seo/structured_data/generator.rb', line 25

def person(**properties)
  person = Person.new(**properties)
  yield(person) if block_given?
  person
end

.product(**properties) {|product| ... } ⇒ Object

Yields:



31
32
33
34
35
# File 'lib/better_seo/structured_data/generator.rb', line 31

def product(**properties)
  product = Product.new(**properties)
  yield(product) if block_given?
  product
end

.recipe(**properties) {|recipe| ... } ⇒ Object

Yields:



67
68
69
70
71
# File 'lib/better_seo/structured_data/generator.rb', line 67

def recipe(**properties)
  recipe = Recipe.new(**properties)
  yield(recipe) if block_given?
  recipe
end