Class: PagesCore::SitemapsController

Inherits:
ApplicationController show all
Includes:
PagePathHelper
Defined in:
app/controllers/pages_core/sitemaps_controller.rb

Instance Attribute Summary

Attributes included from Authentication

#current_user

Instance Method Summary collapse

Methods included from PagePathHelper

#page_path, #page_url

Methods included from StaticCacheController

#disable_static_cache!, #static_cached?

Methods included from PoliciesHelper

#policy, #verify_policy, #verify_policy_with_proc

Methods included from ProcessTitler

inc_number_of_requests, original_title

Methods included from LocalesHelper

#content_locale

Methods included from ErrorRenderer

#render_error

Methods included from Authentication

#authenticate!, #deauthenticate!, #logged_in?

Instance Method Details

#indexObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/pages_core/sitemaps_controller.rb', line 8

def index
  @sitemaps = PagesCore::Sitemap.sitemaps.flat_map do |entry|
    if entry.is_a?(Proc)
      locales.map { |l| instance_exec(l, &entry) }
    else
      entry
    end
  end.compact_blank.uniq
end

#pagesObject



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/pages_core/sitemaps_controller.rb', line 18

def pages
  render_sitemap do |map|
    Page.published.where.not(skip_index: true)
        .localized(content_locale).find_each do |page|
      next if page.redirects?

      map.add(page_url(page.locale, page), lastmod: page.updated_at)
    end
  end
end