Sha256: 7a8c2ab727021f769c6d1207a977c4d3fcc1922409d48b878ddb4ee80abc00b3

Contents?: true

Size: 701 Bytes

Versions: 12

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

module Maglev
  class SitemapController < ApplicationController
    include Maglev::FetchersConcern
    include Maglev::ServicesConcern
    include Maglev::ContentLocaleConcern

    before_action :verify_request_format!
    before_action :fetch_maglev_site

    def index
      @host = request.protocol + fetch_host
      @pages = fetch_pages
    end

    protected

    def fetch_host
      request.headers['HTTP_X_MAGLEV_HOST'] || request.host
    end

    def fetch_pages
      Maglev::Page.all.visible
    end

    def verify_request_format!
      raise ActionController::UnknownFormat, 'Sitemap is only rendered as XML' if request.format != 'xml'
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
maglevcms-1.7.3 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.7.2 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.7.1 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.7.0 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.6.1 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.6.0 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.5.1 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.4.0 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.3.0 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.2.2 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.2.1 app/controllers/maglev/sitemap_controller.rb
maglevcms-1.2.0 app/controllers/maglev/sitemap_controller.rb