0

In production, the meta robots on my website is configured to be "INDEX,FOLLOW".

In staging, I run an sql query to insert or update it in the core_config_data table to be "NOINDEX,NOFOLLOW".

However, when I try to set it and lock it in the env.php file, Magento tell me that's not possible :

xxx@yyy[19/08/20 15:42:42]:~/xxx/$ php bin/magento config:set --lock-env design/search_engine_robots/default_robots "NOINDEX,NOFOLLOW"
The "design/search_engine_robots/default_robots" path doesn't exist. Verify and try again.

And magento is right : the config design/search_engine_robots/default_robots does not exists in a system.xml file but in vendor/magento/module-theme/view/adminhtml/ui_component/design_config_form.xml

Is there any way to lock the magento design configuration values in the env.php file ?

In my opinion, it would be very convenient to set it in the file as the value is stored in core_config_data, like all the other configurations.

0

I think this happens because the path you are using does not actually exist in a system.xml file. Even if it's saved in the core_config_data table as the rest of the config values, it is managed from the design management section. this section is not generated by system.xml files, but by the design_config_form.xml ui component.
the method that validates if the config path is ok Magento\Config\Model\Config\PathValidator::validate checks only what's generated by the system.xml files.

A quick and dirty solution would be to write a plugin for the method mentioned above and make it return true if the path matches your desired path.

2
  • Thanks for your answer. Yeah that's my conclusion too (for the system.xml). I have the same issue with all my customers so a plugin is a good idead as it could do the job but I'll have to install it everywhere, just to be convenient for me... I think I'll continue the good old core_config_data insert or replace query for these value... I'll log it on the github anyway because I think it could be very convenient for this feature to exist! have a nice day
    – beluga
    Aug 19 '20 at 16:29
  • I have the exact opposite issue. I'm trying to update the robot value but can't because the conf is locked. Updating in my config php or in the database makes no change. And the magento doesn't recognize the path. Probably because of that design config form; I will dig into that too !
    – Claims
    Jan 17 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.