Module: NoCms::Seo::SeoHelper
- Defined in:
- app/helpers/no_cms/seo/seo_helper.rb
Instance Method Summary collapse
- #canonical_url_tag(canonical_url = '') ⇒ Object
- #meta_description_tag(default_description = '') ⇒ Object
- #robots_tag(options = {}) ⇒ Object
- #title_tag(default_title) ⇒ Object
Instance Method Details
#canonical_url_tag(canonical_url = '') ⇒ Object
3 4 5 6 |
# File 'app/helpers/no_cms/seo/seo_helper.rb', line 3 def canonical_url_tag canonical_url = '' canonical_url = canonical_url.blank? ? @seo_info.canonical_url(request.host_with_port) : canonical_url content_tag :link, nil, rel: 'canonical', href: canonical_url unless canonical_url.blank? end |
#meta_description_tag(default_description = '') ⇒ Object
8 9 10 11 |
# File 'app/helpers/no_cms/seo/seo_helper.rb', line 8 def default_description = '' description = default_description.blank? ? @seo_info.description : default_description content_tag :meta, nil, name: 'description', content: description unless description.blank? end |
#robots_tag(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/no_cms/seo/seo_helper.rb', line 18 def robots_tag = {} ||= {} no_index = [:no_index].nil? ? @seo_info.no_index? : [:no_index] no_follow = [:no_follow].nil? ? @seo_info.no_follow? : [:no_follow] content = no_index ? "noindex" : "index" content += ', ' content += no_follow ? "nofollow" : "follow" content_tag :meta, nil, name: 'robots', content: content end |
#title_tag(default_title) ⇒ Object
13 14 15 16 |
# File 'app/helpers/no_cms/seo/seo_helper.rb', line 13 def title_tag default_title title = default_title.blank? ? @seo_info.title : default_title content_tag :title, title unless title.blank? end |