Class: LeanCms::MetaTag

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/lean_cms/meta_tag.rb

Instance Method Summary collapse

Instance Method Details

#description_with_fallback(fallback = nil) ⇒ Object

Get description with fallback



16
17
18
# File 'app/models/lean_cms/meta_tag.rb', line 16

def description_with_fallback(fallback = nil)
  description.presence || fallback
end

#has_og_image?Boolean

Check if has open graph image

Returns:

  • (Boolean)


21
22
23
# File 'app/models/lean_cms/meta_tag.rb', line 21

def has_og_image?
  og_image_url.present?
end

#has_structured_data?Boolean

Check if has structured data

Returns:

  • (Boolean)


26
27
28
# File 'app/models/lean_cms/meta_tag.rb', line 26

def has_structured_data?
  structured_data.present? && structured_data.is_a?(Hash)
end

#title_with_fallback(fallback = nil) ⇒ Object

Get title with fallback



11
12
13
# File 'app/models/lean_cms/meta_tag.rb', line 11

def title_with_fallback(fallback = nil)
  title.presence || fallback
end