Module: Jekyll::Locale::Helper

Included in:
AutoPage, Document, Page
Defined in:
lib/jekyll/locale/mixins/helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#canonObject (readonly)

Returns the value of attribute canon.



5
6
7
# File 'lib/jekyll/locale/mixins/helper.rb', line 5

def canon
  @canon
end

#relative_pathObject (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

#inspectObject 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


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_hreflangsObject



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

Returns:

  • (Boolean)


7
8
9
# File 'lib/jekyll/locale/mixins/helper.rb', line 7

def setup_hreflangs?
  true
end