Module: Spree::StoreDecorator
- Defined in:
- app/decorators/models/spree/store_decorator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #jsonld_data ⇒ Object
- #seo_data ⇒ Object
- #seo_description ⇒ Object
- #seo_image ⇒ Object
-
#seo_name ⇒ Object
following conventions of other models.
- #seo_tagline ⇒ Object
Class Method Details
.prepended(base) ⇒ Object
5 6 7 8 9 |
# File 'app/decorators/models/spree/store_decorator.rb', line 5 def self.prepended(base) base.class_eval do include SolidusSeo::Model end end |
Instance Method Details
#jsonld_data ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/decorators/models/spree/store_decorator.rb', line 49 def jsonld_data base = { "@context": "http://schema.org", "@type": "Store", "name": name, "logo": seo_image, "image": seo_image, "url": store_host, "@id": store_host } build_jsonld_with base, :contact_points, :address, :geo, :same_as, :opening_hours_specification end |
#seo_data ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/decorators/models/spree/store_decorator.rb', line 29 def seo_data { site: seo_name, description: seo_description, image_src: seo_image, og: { site_name: :site, type: 'website', image: { '_': :image_src, alt: :site } }, twitter: { card: 'summary', # site: '@yourcompany' } } end |
#seo_description ⇒ Object
20 21 22 |
# File 'app/decorators/models/spree/store_decorator.rb', line 20 def seo_description plain_text() end |
#seo_image ⇒ Object
16 17 18 |
# File 'app/decorators/models/spree/store_decorator.rb', line 16 def seo_image url_helper.image_url(Spree::Config.logo, host: store_host) end |
#seo_name ⇒ Object
following conventions of other models
12 13 14 |
# File 'app/decorators/models/spree/store_decorator.rb', line 12 def seo_name seo_title.presence || name end |
#seo_tagline ⇒ Object
24 25 26 27 |
# File 'app/decorators/models/spree/store_decorator.rb', line 24 def seo_tagline # TODO: Retrieve from DB 'This is the default store tagline' end |