Module: Seorel::Helper
- Defined in:
- lib/seorel/helper.rb
Instance Method Summary collapse
- #render_description ⇒ Object
- #render_meta_tags ⇒ Object
- #render_open_graph ⇒ Object
- #render_title ⇒ Object
- #render_twitter_cards ⇒ Object
- #seorel_locale ⇒ Object
Instance Method Details
#render_description ⇒ Object
16 17 18 |
# File 'lib/seorel/helper.rb', line 16 def render_description content_tag :meta, nil, name: 'description', content: seorel_params.description end |
#render_meta_tags ⇒ Object
8 9 10 |
# File 'lib/seorel/helper.rb', line 8 def [render_title, render_description, render_open_graph, render_twitter_cards].join("\n").html_safe end |
#render_open_graph ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/seorel/helper.rb', line 20 def render_open_graph [ content_tag(:meta, nil, property: 'og:type', content: 'website'), content_tag(:meta, nil, property: 'og:url', content: request.url), content_tag(:meta, nil, property: 'og:title', content: seorel_params.title), content_tag(:meta, nil, property: 'og:description', content: seorel_params.description), content_tag(:meta, nil, property: 'og:image', content: seorel_params.image), content_tag(:meta, nil, property: 'og:locale', content: seorel_locale) ].join("\n").html_safe end |
#render_title ⇒ Object
12 13 14 |
# File 'lib/seorel/helper.rb', line 12 def render_title content_tag :title, seorel_params.title end |
#render_twitter_cards ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/seorel/helper.rb', line 31 def render_twitter_cards [ content_tag(:meta, nil, name: 'twitter:card', content: 'summary_large_image'), content_tag(:meta, nil, name: 'twitter:url', content: request.url), content_tag(:meta, nil, name: 'twitter:title', content: seorel_params.title), content_tag(:meta, nil, name: 'twitter:description', content: seorel_params.description), content_tag(:meta, nil, name: 'twitter:image', content: seorel_params.image) ].join("\n").html_safe end |
#seorel_locale ⇒ Object
3 4 5 6 |
# File 'lib/seorel/helper.rb', line 3 def seorel_locale locale = (I18n.locale.to_s.size == 2) ? "#{I18n.locale}_#{I18n.locale}" : I18n.locale.to_s "#{locale[0..1].downcase}_#{locale[3..4].upcase}" end |