Sha256: 3aaf88f9b59565f251ccc0e5333f825353d51384a3d72def5111892d7690fdb6
Contents?: true
Size: 1018 Bytes
Versions: 1
Compression:
Stored size: 1018 Bytes
Contents
# frozen_string_literal: true module PagesCore class SitemapsController < ApplicationController include PagesCore::PagePathHelper static_cache :index, :pages 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 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 private def locales if PagesCore.config.locales PagesCore.config.locales.keys else [I18n.default_locale] end end def render_sitemap(&) respond_to do |format| format.xml { render xml: PagesCore::Sitemap.new(&).to_xml } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.15.5 | app/controllers/pages_core/sitemaps_controller.rb |