seo icon indicating copy to clipboard operation
seo copied to clipboard

No: 'noindex' detected in 'robots' meta tag

Open nhyoga opened this issue 1 year ago • 6 comments

Have added production variables in .en Have editied plugin settings to remove logic.

Google still reports noindex detected.

This is really in need of fixing

nhyoga avatar Jan 30 '25 07:01 nhyoga

To add to this - turned off plugin and google console reports all fine.

Should be fixed or removed from Craft store

nhyoga avatar Jan 30 '25 07:01 nhyoga

In order to resolve this, your .env must have a CRAFT_ENVIRONMENT=production set. Otherwise, the plugin will assume the site is stage or dev and set it to noindex.

alexjcollins avatar Jan 30 '25 08:01 alexjcollins

Yes I have done this too. It doesn't work. Plugin Setting show robots.txt logic using this. Take out the if production logic - noindex heading still persists. Turn off plugin and Google console will index it. I'll have another deep dive on this later today but there does seem an issue.

alanski66 avatar Jan 30 '25 08:01 alanski66

I've 'fixed' this with adding: vendor/ether/seo/src/services/SeoService.php // headers do not seem to be setting properly so adding this explicitly if (Craft::$app->env == 'production') { $headers->set('x-robots-tag', 'all'); return; } It seems without explicitly setting to index and relying on the false test !=='production' Craft is sets to 'none' by default - seeming to ignore the attempt later doewn to use the control panel robots text to also set this .

Not really sure whats going on here and have filed a question with craft repo about default X-Robots settings.

alanski66 avatar Jan 30 '25 16:01 alanski66

Additionally the issue is worse :) in model SEOdata the robot meta tag (line 353) <meta name="robots" content="WHATGOESHERE?" /> is also an issue. for some reason this code if (Craft::$app->config->general->devMode) return 'none, noimageindex'; seems to fail to detect devMode. devMode is false in .env and config but still returns true.

My solution was to add: if (Craft::$app->env == 'production') return 'all'

Real mystery is why craft keeps returning devmode as true

alanski66 avatar Jan 30 '25 22:01 alanski66

Just to update Craft maintainers cant replicate any failure to detect devMode / environment. Plugin logic works as per Craft plugin should however the problem still persists. However it is solved by explcitly declaring production all as in the two examples above.

alanski66 avatar Feb 11 '25 14:02 alanski66