Class: MetaTags::Configuration
- Inherits:
-
Object
- Object
- MetaTags::Configuration
- Defined in:
- lib/meta_tags/configuration.rb
Overview
MetaTags configuration.
Instance Attribute Summary collapse
-
#description_limit ⇒ Object
How many characters to truncate description to.
-
#keywords_limit ⇒ Object
How many characters to truncate keywords to.
-
#keywords_lowercase ⇒ Object
Should keywords forced into lowercase?.
-
#keywords_separator ⇒ Object
Keywords separator - a string to join keywords with.
-
#minify_output ⇒ Object
When true, the output will not include new line characters between meta tags.
-
#open_meta_tags ⇒ Object
Switches between open (<meta … >) and closed (<meta … />) meta tags.
-
#property_tags ⇒ Object
readonly
Custom meta tags that should use ‘property` attribute instead of `name` - an array of strings or symbols representing their names or name-prefixes.
-
#skip_canonical_links_on_noindex ⇒ Object
Configure whenever Meta-Tags should skip canonicals on pages with noindex: true “shouldn’t mix noindex & rel=canonical comes from: they’re very contradictory pieces of information for us.” - John Mueller (Webmaster Trends Analyst at Google) www.reddit.com/r/TechSEO/comments/8yahdr/2_questions_about_the_canonical_tag/e2dey9i/.
-
#title_limit ⇒ Object
How many characters to truncate title to.
-
#title_tag_attributes ⇒ Object
HTML attributes for the title tag.
-
#truncate_on_natural_separator ⇒ Object
A string or regexp separator to truncate text at a natural break.
-
#truncate_site_title_first ⇒ Object
Truncate site_title instead of title.
Instance Method Summary collapse
- #default_property_tags ⇒ Object
-
#initialize ⇒ Configuration
constructor
Initializes a new instance of Configuration class.
- #open_meta_tags? ⇒ Boolean
- #reset_defaults! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Initializes a new instance of Configuration class.
49 50 51 |
# File 'lib/meta_tags/configuration.rb', line 49 def initialize reset_defaults! end |
Instance Attribute Details
#description_limit ⇒ Object
How many characters to truncate description to.
19 20 21 |
# File 'lib/meta_tags/configuration.rb', line 19 def description_limit @description_limit end |
#keywords_limit ⇒ Object
How many characters to truncate keywords to.
22 23 24 |
# File 'lib/meta_tags/configuration.rb', line 22 def keywords_limit @keywords_limit end |
#keywords_lowercase ⇒ Object
Should keywords forced into lowercase?
28 29 30 |
# File 'lib/meta_tags/configuration.rb', line 28 def keywords_lowercase @keywords_lowercase end |
#keywords_separator ⇒ Object
Keywords separator - a string to join keywords with.
25 26 27 |
# File 'lib/meta_tags/configuration.rb', line 25 def keywords_separator @keywords_separator end |
#minify_output ⇒ Object
When true, the output will not include new line characters between meta tags. Default is false.
36 37 38 |
# File 'lib/meta_tags/configuration.rb', line 36 def minify_output @minify_output end |
#open_meta_tags ⇒ Object
Switches between open (<meta … >) and closed (<meta … />) meta tags. Default is true, which means “open”.
32 33 34 |
# File 'lib/meta_tags/configuration.rb', line 32 def @open_meta_tags end |
#property_tags ⇒ Object (readonly)
Custom meta tags that should use ‘property` attribute instead of `name`
-
an array of strings or symbols representing their names or name-prefixes.
40 41 42 |
# File 'lib/meta_tags/configuration.rb', line 40 def @property_tags end |
#skip_canonical_links_on_noindex ⇒ Object
Configure whenever Meta-Tags should skip canonicals on pages with noindex: true “shouldn’t mix noindex & rel=canonical comes from: they’re very contradictory pieces of information for us.”
-
John Mueller (Webmaster Trends Analyst at Google)
www.reddit.com/r/TechSEO/comments/8yahdr/2_questions_about_the_canonical_tag/e2dey9i/
46 47 48 |
# File 'lib/meta_tags/configuration.rb', line 46 def skip_canonical_links_on_noindex @skip_canonical_links_on_noindex end |
#title_limit ⇒ Object
How many characters to truncate title to.
7 8 9 |
# File 'lib/meta_tags/configuration.rb', line 7 def title_limit @title_limit end |
#title_tag_attributes ⇒ Object
HTML attributes for the title tag.
10 11 12 |
# File 'lib/meta_tags/configuration.rb', line 10 def title_tag_attributes @title_tag_attributes end |
#truncate_on_natural_separator ⇒ Object
A string or regexp separator to truncate text at a natural break.
16 17 18 |
# File 'lib/meta_tags/configuration.rb', line 16 def truncate_on_natural_separator @truncate_on_natural_separator end |
#truncate_site_title_first ⇒ Object
Truncate site_title instead of title.
13 14 15 |
# File 'lib/meta_tags/configuration.rb', line 13 def truncate_site_title_first @truncate_site_title_first end |
Instance Method Details
#default_property_tags ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/meta_tags/configuration.rb', line 53 def [ # App Link metadata https://developers.facebook.com/docs/applinks/metadata-reference "al", # Open Graph Markup https://developers.facebook.com/docs/sharing/webmasters#markup "fb", "og", # Facebook OpenGraph Object Types https://developers.facebook.com/docs/reference/opengraph # Note that these tags are used in a regex, so including e.g. 'restaurant' will affect # 'restaurant:category', 'restaurant:price_rating', and anything else under that namespace. "article", "book", "books", "business", "fitness", "game", "music", "place", "product", "profile", "restaurant", "video" ].freeze end |
#open_meta_tags? ⇒ Boolean
78 79 80 |
# File 'lib/meta_tags/configuration.rb', line 78 def !! end |
#reset_defaults! ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/meta_tags/configuration.rb', line 82 def reset_defaults! @title_limit = 70 @truncate_site_title_first = false @truncate_on_natural_separator = " " @title_tag_attributes = {} @description_limit = 300 @keywords_limit = 255 @keywords_separator = ", " @keywords_lowercase = true @property_tags = .dup @open_meta_tags = true @minify_output = false @skip_canonical_links_on_noindex = false end |