class Octopress::Multilingual::SiteHook

Public Instance Methods

merge_payload(payload, site) click to toggle source
# File lib/octopress-multilingual/hooks.rb, line 24
def merge_payload(payload, site)
  Octopress::Multilingual.site_payload
end
post_read(site) click to toggle source

Generate site_payload so other plugins can access

# File lib/octopress-multilingual/hooks.rb, line 6
def post_read(site)
  Octopress::Multilingual.site = site
  site.config['languages'] = Octopress::Multilingual.languages
end
pre_render(site) click to toggle source
# File lib/octopress-multilingual/hooks.rb, line 11
def pre_render(site)

  # Add translation page data to each page or post.
  #
  [site.pages, site.posts].flatten.select(&:translated).each do |item|
    # Access array of translated items via (post/page).translations
    item.data.merge!({
      'translations' => item.translations,
      'translated' => item.translated
    })
  end
end