Skip to content

Robots meta tag should be configurable on storeview level, right now it's only on website level #35453

Open
@hostep

Description

@hostep

Preconditions (*)

  1. Magento 2.3.7 or 2.4.4. or any recent version

Steps to reproduce (*)

  1. Use a clean Magento installation
  2. Setup at least 2 storeviews
  3. In the backoffice, go to Content > Design > Configuration
  4. Click on 'Edit' for one of the storeviews
  5. Click open the 'Search Engine Robots' section

Expected result (*)

  1. To be able to configure the 'Default Robots' setting on storeview level

Actual result (*)

  1. The 'Default Robots' setting is only configurable on website level

Discussion

We have a case where we want to add a storeview to a shop that is live, for the shop owner to setup some new content
But we don't want for search engines to start indexing this storeview already.
So we would like to see the 'Default Robots' setting configurable on storeview level.
I'm almost 99% convinced that this was possible in earlier versions of Magento (2.0, 2.1, 2.2 maybe?), but now it's not longer possible.
From some testing and setting the config value directly in the database, this works fine, but there is currently no way to set it using the backoffice of Magento on storeview level.

Possible solution

diff --git a/app/code/Magento/Theme/Model/Design/Config/DataProvider.php b/app/code/Magento/Theme/Model/Design/Config/DataProvider.php
index 4cc6e81c3b8..7e15da7eb04 100644
--- a/app/code/Magento/Theme/Model/Design/Config/DataProvider.php
+++ b/app/code/Magento/Theme/Model/Design/Config/DataProvider.php
@@ -163,6 +163,8 @@ class DataProvider extends AbstractDataProvider
      */
     private function getSearchEngineRobotsMetadata($scope, array $fields = [])
     {
+        unset($fields['default_robots']);
+
         if ($scope == \Magento\Store\Model\ScopeInterface::SCOPE_STORES) {
             $resetToDefaultsData = [
                 'arguments' => [
diff --git a/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml
index dfe11f3120c..7102d3eb94b 100644
--- a/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml
+++ b/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml
@@ -274,7 +274,6 @@
                     <dataType>text</dataType>
                     <label translate="true">Default Robots</label>
                     <dataScope>default_robots</dataScope>
-                    <scopeLabel>[WEBSITE]</scopeLabel>
                 </settings>
                 <formElements>
                     <select>

It's a bit ugly, but for some reason Magento developers decided that the entire Search Engine Robots section should only be configurable on website scope, this probably makes sense for the 'custom instructions of the robots.txt file' content, but it doesn't make sense for the 'Default Robots' config setting.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: ContentComponent: ConfigIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions