Class: Spree::SeoController

Inherits:
StoreController show all
Includes:
BaseHelper, StorefrontHelper
Defined in:
app/controllers/spree/seo_controller.rb

Instance Method Summary collapse

Methods included from StorefrontHelper

#as_aspect_ratio, #page_description, #page_image, #paths_equal?, #render_storefront_partials, #show_account_pane?, #svg_country_icon, #tailwind_classes_for

Methods inherited from StoreController

#current_taxon, #default_products_sort, #permitted_products_params, #products_filters_params, #render_404_if_store_not_exists, #store_filter_names, #store_filter_names_hash

Methods included from AnalyticsHelper

#analytics_event_handlers, #track_event, #unsupported_event?

Methods included from WishlistHelper

#current_wishlist

Methods included from PasswordProtected

#redirect_to_password

Methods included from ThemeConcern

#default_url_options, #set_theme_view_paths

Instance Method Details

#robotsObject



6
7
8
# File 'app/controllers/spree/seo_controller.rb', line 6

def robots
  render view: 'seo/robots', layout: false, content_type: 'text/plain', locals: { store: current_store }
end

#sitemapObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/spree/seo_controller.rb', line 10

def sitemap
  unless current_store.prefers_index_in_search_engines?
    head :not_found
    return
  end

  respond_to do |format|
    format.xml
    format.gzip do
      gz_xml = ActiveSupport::Gzip.compress(render_to_string(template: 'spree/seo/sitemap', formats: [:xml]))
      send_data(gz_xml, filename: 'sitemap.xml.gz', type: 'application/x-gzip', disposition: 'inline')
    end
  end
end