Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add seo_robots to the Stores, add robots to the head (#10542)
Piotr Pańkof3e25243c0b0
diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rbindex 26e76cb633..181f99e234 100644--- a/core/app/helpers/spree/base_helper.rb+++ b/core/app/helpers/spree/base_helper.rb@@ -208,5 +208,12 @@ module Spreestyle if style.in? Spree::Image.styles.with_indifferent_accessendend++ def meta_robots+ return unless current_store.respond_to?(:seo_robots)+ return if current_store.seo_robots.blank?++ tag('meta', name: 'robots', content: current_store.seo_robots)+ endendenddiff --git a/core/db/migrate/20201013084504_add_seo_robots_to_spree_stores.rb b/core/db/migrate/20201013084504_add_seo_robots_to_spree_stores.rbnew file mode 100644index 0000000000..65bb7a1c36--- /dev/null+++ b/core/db/migrate/20201013084504_add_seo_robots_to_spree_stores.rb@@ -0,0 +1,5 @@+class AddSeoRobotsToSpreeStores < ActiveRecord::Migration[6.0]+ def change+ add_column :spree_stores, :seo_robots, :string unless column_exists?(:spree_stores, :seo_robots)+ end+enddiff --git a/frontend/app/views/spree/shared/_head.html.erb b/frontend/app/views/spree/shared/_head.html.erbindex 700739c7f9..d4ccf34a0f 100644--- a/frontend/app/views/spree/shared/_head.html.erb+++ b/frontend/app/views/spree/shared/_head.html.erb@@ -2,6 +2,7 @@<meta name="viewport" content="width=device-width, initial-scale=1" /><%== og_meta_data_tags %><%== meta_data_tags %>+<%== meta_robots %><%= canonical_tag(current_store.url) %><%= favicon_link_tag 'favicon.ico' %><%= stylesheet_link_tag 'spree/frontend/all', media: 'screen', 'data-turbolinks-track': 'reload' %>