Module: SeoLandingPages::Helper
- Defined in:
- lib/seo_landing_pages/helper.rb
Instance Method Summary collapse
-
#seo_landing_page_description(i18n: false) ⇒ Object
Public: landing page description.
-
#seo_landing_page_description_tag(i18n: false) ⇒ Object
Public: html description meta tag with the landing page description.
-
#seo_landing_page_keywords(i18n: false) ⇒ Object
Public: landing page keywords.
-
#seo_landing_page_keywords_tag(i18n: false) ⇒ Object
Public: html keywords meta tag with the landing page keywords.
-
#seo_landing_page_title(i18n: false) ⇒ Object
Public: landing page title.
-
#seo_landing_page_title_tag(i18n: false) ⇒ Object
Public: html title tag with the landing page title.
Instance Method Details
#seo_landing_page_description(i18n: false) ⇒ Object
Public: landing page description.
-
i18n: false = render plain text description. This is the default.
true = description is an i18n key, so translate it.
If the landing page description is empty it returns nothing.
43 44 45 46 47 48 49 50 |
# File 'lib/seo_landing_pages/helper.rb', line 43 def seo_landing_page_description(i18n: false) if seo_current_landing_page description = seo_current_landing_page.description if description.present? i18n ? t(description) : description end end end |
#seo_landing_page_description_tag(i18n: false) ⇒ Object
Public: html description meta tag with the landing page description.
-
i18n: false = render plain text description. This is the default.
true = description is an i18n key, so translate it.
If the landing page description is empty it returns nothing.
32 33 34 35 36 37 |
# File 'lib/seo_landing_pages/helper.rb', line 32 def seo_landing_page_description_tag(i18n: false) description = seo_landing_page_description i18n: i18n if description.present? "<meta name='description' content='#{ description }'/>".html_safe end end |
#seo_landing_page_keywords(i18n: false) ⇒ Object
Public: landing page keywords.
-
i18n: false = render plain text keywords. This is the default.
true = keywords is an i18n key, so translate it.
If the landing page keywords is empty it returns nothing.
67 68 69 70 71 72 73 74 |
# File 'lib/seo_landing_pages/helper.rb', line 67 def seo_landing_page_keywords(i18n: false) if seo_current_landing_page keywords = seo_current_landing_page.keywords if keywords.present? i18n ? t(keywords) : keywords end end end |
#seo_landing_page_keywords_tag(i18n: false) ⇒ Object
Public: html keywords meta tag with the landing page keywords.
-
i18n: false = render plain text keywords. This is the default.
true = keywords is an i18n key, so translate it.
If the landing page keywords is empty it returns nothing.
56 57 58 59 60 61 |
# File 'lib/seo_landing_pages/helper.rb', line 56 def seo_landing_page_keywords_tag(i18n: false) keywords = seo_landing_page_keywords i18n: i18n if keywords.present? "<meta name='keywords' content='#{ keywords }'/>".html_safe end end |
#seo_landing_page_title(i18n: false) ⇒ Object
Public: landing page title.
-
i18n: false = render plain text title. This is the default.
true = title is an i18n key, so translate it.
19 20 21 22 23 24 25 26 |
# File 'lib/seo_landing_pages/helper.rb', line 19 def seo_landing_page_title(i18n: false) if seo_current_landing_page title = seo_current_landing_page.title if title.present? i18n ? t(title) : title end end end |
#seo_landing_page_title_tag(i18n: false) ⇒ Object
Public: html title tag with the landing page title.
-
i18n: false = render plain text title. This is the default.
true = title is an i18n key, so translate it.
If the landing page title is empty it returns nothing.
9 10 11 12 13 14 |
# File 'lib/seo_landing_pages/helper.rb', line 9 def seo_landing_page_title_tag(i18n: false) title = seo_landing_page_title i18n: i18n if title.present? "<title>#{ title }</title>".html_safe end end |