Class: Workarea::Metadata::ContentPage
- Inherits:
-
Workarea::Metadata
- Object
- Workarea::Metadata
- Workarea::Metadata::ContentPage
- Defined in:
- app/queries/workarea/metadata/content_page.rb
Instance Attribute Summary
Attributes inherited from Workarea::Metadata
Instance Method Summary collapse
-
#description ⇒ String
Provides a default value for use as the html content meta tag using an excerpt of the page’s content blocks with a length determined by the configurable max words.
-
#title ⇒ String
Provides a default value for use as the html page title using the name of the page and its parent taxon if available.
Methods inherited from Workarea::Metadata
automation_klass, #initialize, model_name, update, #update
Constructor Details
This class inherits a constructor from Workarea::Metadata
Instance Method Details
#description ⇒ String
Provides a default value for use as the html content meta tag using an excerpt of the page’s content blocks with a length determined by the configurable max words.
29 30 31 32 33 34 35 |
# File 'app/queries/workarea/metadata/content_page.rb', line 29 def description ExtractContentBlockText.new(content.blocks) .text .split(/\s+/) .first(max_words) .join(' ') end |
#title ⇒ String
Provides a default value for use as the html page title using the name of the page and its parent taxon if available.
12 13 14 15 16 17 18 19 20 21 |
# File 'app/queries/workarea/metadata/content_page.rb', line 12 def title title = [model.name] taxon = model.taxon if taxon.present? && taxon.parent.present? && !taxon.parent.root? title << taxon.parent.name end title.join(' - ') end |