Description
Preconditions (*)
- Magento 2.3.7 or 2.4.4. or any recent version
Steps to reproduce (*)
- Use a clean Magento installation
- Setup at least 2 storeviews
- In the backoffice, go to Content > Design > Configuration
- Click on 'Edit' for one of the storeviews
- Click open the 'Search Engine Robots' section
Expected result (*)
- To be able to configure the 'Default Robots' setting on storeview level
Actual result (*)
- 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”.