magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

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

Open hostep opened this issue 2 years ago • 9 comments

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.
  • [x] 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”.

hostep avatar May 11 '22 08:05 hostep

Hi @hostep. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar May 11 '22 08:05 m2-assistant[bot]

Just took a look at a Magento 2.1.7 and 2.1.11 shop, in 2.1.7 it was still configurable on storeview level, in 2.1.11 it no longer is.

So this got changed (broken?) somewhere between Magento 2.1.7 and 2.1.11

hostep avatar May 11 '22 08:05 hostep

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar May 11 '22 15:05 m2-assistant[bot]

Hello @hostep,

Thanks for the report and collaboration!

We have verified the issue in Magento 2.4-develop branch and the issue is reproducible for us. Hence confirming the issue.

Please refer to the below screenshots:

In the Storeview the Search Engine Robots section is not editable

image

In the Website level, the option is editable:

image

Thanks

engcom-Hotel avatar May 11 '22 15:05 engcom-Hotel

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-3047 is successfully created for this GitHub issue.

github-jira-sync-bot avatar May 11 '22 15:05 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar May 11 '22 15:05 m2-assistant[bot]

@magento i'm working on it

Pranav-242 avatar May 30 '22 11:05 Pranav-242

Hi,

Thanks for reporting and fixing this. I think we should do the same for custom_instructions, should'nt we ?

Nuranto avatar Jan 08 '24 10:01 Nuranto

It only makes sense to configure custom_instructions differently if you use different domain names and want a different /robots.txt "file" per domain name. But it looks like you can configure different base_url's on storeview level, so then yes, we should make it configurable on storeview level as well I guess 👍

hostep avatar Jan 08 '24 16:01 hostep