Module: Jekyll::Locale::Helper
Instance Attribute Summary collapse
-
#canon ⇒ Object
readonly
Returns the value of attribute canon.
-
#relative_path ⇒ Object
readonly
Returns the value of attribute relative_path.
Instance Method Summary collapse
- #inspect ⇒ Object (also: #to_s)
- #permalink ⇒ Object
- #setup_hreflangs ⇒ Object
- #setup_hreflangs? ⇒ Boolean
Instance Attribute Details
#canon ⇒ Object (readonly)
Returns the value of attribute canon.
5 6 7 |
# File 'lib/jekyll/locale/mixins/helper.rb', line 5 def canon @canon end |
#relative_path ⇒ Object (readonly)
Returns the value of attribute relative_path.
5 6 7 |
# File 'lib/jekyll/locale/mixins/helper.rb', line 5 def relative_path @relative_path end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
26 27 28 |
# File 'lib/jekyll/locale/mixins/helper.rb', line 26 def inspect "#<#{self.class} @canon=#{canon.inspect} @locale=#{locale.inspect}>" end |
#permalink ⇒ Object
21 22 23 24 |
# File 'lib/jekyll/locale/mixins/helper.rb', line 21 def permalink canon_link = super File.join(locale, canon_link) if canon_link end |
#setup_hreflangs ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/jekyll/locale/mixins/helper.rb', line 11 def setup_hreflangs @hreflangs = (canon.locale_pages + [canon] - [self]).map do |locale_page| { "locale" => locale_page.locale || site.locale_handler.default_locale, "relation" => locale_page.locale ? "alternate" : "canonical", "url" => locale_page.url, } end end |
#setup_hreflangs? ⇒ Boolean
7 8 9 |
# File 'lib/jekyll/locale/mixins/helper.rb', line 7 def setup_hreflangs? true end |