mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Add noindex meta tag for invisible shops and staging environment
This commit is contained in:
@@ -7,7 +7,7 @@ class EnterprisesController < BaseController
|
||||
|
||||
# These prepended filters are in the reverse order of execution
|
||||
prepend_before_filter :set_order_cycles, :require_distributor_chosen, :reset_order, only: :shop
|
||||
before_filter :check_stock_levels, only: :shop
|
||||
before_filter :check_stock_levels, :set_noindex_meta_tag, only: :shop
|
||||
|
||||
before_filter :clean_permalink, only: :check_permalink
|
||||
before_filter :enable_embedded_shopfront
|
||||
@@ -85,4 +85,8 @@ class EnterprisesController < BaseController
|
||||
order_cycle_options = OrderCycle.active.with_distributor(distributor)
|
||||
order.order_cycle = order_cycle_options.first if order_cycle_options.count == 1
|
||||
end
|
||||
|
||||
def set_noindex_meta_tag
|
||||
@noindex_meta_tag = true unless current_distributor.visible?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
%meta{property: "og:title", content: content_for?(:title) ? yield(:title) : t(:title)}
|
||||
%meta{property: "og:description", content: content_for?(:description) ? yield(:description) : t(:site_meta_description)}
|
||||
%meta{property: "og:image", content: content_for?(:image) ? yield(:image) : ContentConfig.logo.url}
|
||||
- if !Rails.env.production? || @noindex_meta_tag
|
||||
%meta{name: "robots", content: "noindex"}
|
||||
%title= content_for?(:title) ? "#{yield(:title)} - #{t(:title)}".html_safe : "#{t(:welcome_to)} #{t(:title)}"
|
||||
- if Rails.env.production?
|
||||
= favicon_link_tag
|
||||
|
||||
Reference in New Issue
Block a user