Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robots meta tag isn't updating when an entry is re-saved using an SEO Settings field #622

Closed
darylknight opened this issue May 5, 2020 · 20 comments
Labels

Comments

@darylknight
Copy link

We're looking at adding the ability to set a page to noindex with the SEOmatic field. It's currently got some override fields set up and fallbacks to use data from the entry if blank:

image

I've just added the SEO - Settings field so we can set a specific entry to noidex and it works correctly the first time, but otherwise the robots meta tag on the front end won't update again until I manually clear the caches from utilities.

@khalwat
Copy link
Collaborator

khalwat commented May 5, 2020

So I think there might be some confusion here -- the setting in the SEO Settings field relates to the <meta name="robots"> tag.

It does not affect the /robots.text at all.

If we're talking about the Robots tag itself... any time you save an entry, it should break the cache for that entry. Could there be something else going on here (routing? so other layer of caching?) that might prevent this from happening?

https://nystudio107.com/blog/tips-for-using-seomatic-effectively#caching-and-cache-busting

@khalwat khalwat added the need info Need more information on the issue label May 5, 2020
@darylknight darylknight changed the title Robots.txt isn't updating when an entry is re-saved using an SEO Settings field Robots meta tag isn't updating when an entry is re-saved using an SEO Settings field May 5, 2020
@darylknight
Copy link
Author

Thanks for clarifying Andrew; I just mistyped - I'm not referring to robots.txt at all, my whole question is about the meta tag.

There's no routing or caching on the site - it's a staging server with no cache tags.

@khalwat
Copy link
Collaborator

khalwat commented May 6, 2020

Well, I can run some tests, but I'm pretty sure this cache clearing mechanism is working:

https://github.com/nystudio107/craft-seomatic/blob/v3/src/services/MetaBundles.php#L372

Is there anything else at all on your end that could be affecting this? How does it work in production?

@ExterroDMM
Copy link

Hi,

We are experiencing the same issue. I submitted a ticket to Craft about this, and Brad and Oli and told to get with Andrew here.

When any field in SEOMatic is changed within Craft CMS, the changes are not reflected on the front-end.

This includes robots directives like Daryl mentioned, but also OG images. It will appear in the entry that the change has been made, but the change is not reflected in the page source code on the front end.

We have cleared our CMS cache and front-end cache a number of times to no avail.

@khalwat
Copy link
Collaborator

khalwat commented May 6, 2020

@ExterroDMM What version of Craft CMS, and what version of SEOmatic?

Do you see the expected results in the sidebar preview next to the entry, and just no on the frontend?

@ExterroDMM
Copy link

ExterroDMM commented May 6, 2020

@khalwat Craft - Craft Pro 3.2.10
SEOMatic - 3.2.20
Environment: Live

Yes, previews and meta data render correctly in the CMS and not on the front end.

--

@khalwat
Copy link
Collaborator

khalwat commented May 6, 2020

@ExterroDMM Can you please update to the latest version of SEOmatic? 3.2.20 is fairly old, and the issue may have been addressed.

@darylknight
Copy link
Author

The site hasn't been released yet; I'll have to check again after launch if they decide to go ahead. It seems to be related specifically to using the SEO Settings field with only Robots enabled though. Generally the entry SEO works fine, but I've noticed that changing the Robots setting using the SEO Settings field has no effect until the caches are cleared manually.

@khalwat
Copy link
Collaborator

khalwat commented May 9, 2020

@darylknight let's do a screen share next week to see what is going on here?

Reach out to me on Discord and we'll get a look at this.

@darylknight
Copy link
Author

I've managed to narrow this down; the SEOmatic cache issue for robots meta only happens if it's the homepage of the site. We're using a Structure for all the pages, and the slug of the homepage is __home__. If I change that slug to something like test-index, or test this on any other entry, then it works properly and clears the cache on the robots meta tag when I save the entry. So it looks like it's specifically related to being the homepage of the site.

Unrelated, the field handle was seoSettings. If I followed the docs and used this for testing the value:

{{ entry.seoSettings.metaGlobalVars.robots }}

I got a blank result. If I renamed my field to seoRobots, then it worked correctly. Looks like there's a naming conflict.

{{ entry.seoRobots.metaGlobalVars.robots }}

@khalwat
Copy link
Collaborator

khalwat commented May 14, 2020

AHA! This makes sense -- in some cases, __home__ is normalized to / and in others, it may not be. Let me have a look to see if the cache key it's trying to clear is correct.

As for the seoSettings in the docs, that's the handle of the field... so it will be different depending on what you name your field.

@khalwat khalwat added bug and removed need info Need more information on the issue labels May 14, 2020
@khalwat
Copy link
Collaborator

khalwat commented May 16, 2020

Fixed in 986be8e

You can set your semver to dev-develop to give it a whirl now @darylknight

@khalwat khalwat closed this as completed May 16, 2020
@darylknight
Copy link
Author

Thank you :)

@ExterroDMM
Copy link

ExterroDMM commented May 27, 2020

@darylknight
I tried to update the SEOMatic plugin in our craft. But it is throwing an error.
We are using Navigation plugin as well I tried to update the same but still getting an error like this

image

Do you have any idea about this?

@khalwat
Copy link
Collaborator

khalwat commented May 27, 2020

The above error is coming from the Navigation plugin, not SEOmatic.

It looks like they are assuming that the Gql class exists; you'd need Craft CMS 3.3 or higher for that to be the case.

I'd suggest contacting Verb.io about the issue.

@ExterroDMM
Copy link

@khalwat

I tried to update the Craft latest version and it is working fine. Also, I can able to update the Navigation & SEOMatic plugin on our site.

Thank you.

@ExterroDMM
Copy link

@khalwat

Previously I tried to update the Craft and it was fine in dev. But now I restored the database from prod to dev environment and then I tried to update the craft to latest version and it is throwing an error like this.

image

@khalwat
Copy link
Collaborator

khalwat commented Jun 3, 2020

@ExterroDMM it's hard to see without seeing the full error, but that doesn't appear to be related to SEOmatic.

Try support@craftcms.com ?

@ExterroDMM
Copy link

@khalwat

Here is the full error when I updated the craft. Please check and let me know

Integrity constraint violation: SQLSTATE[23000]: Integrity constraint violation: 1217 Cannot delete or update a parent row: a foreign key constraint fails
The SQL being executed was: DROP TABLE IF EXISTS craft_gqlschemas

Migration: craft\migrations\m190617_164400_add_gqlschemas_table

Output:

dropping {{%gqlschemas}} if it exists ...Exception: SQLSTATE[23000]: Integrity constraint violation: 1217 Cannot delete or update a parent row: a foreign key constraint fails
The SQL being executed was: DROP TABLE IF EXISTS craft_gqlschemas (/home/craft/www/craft/vendor/yiisoft/yii2/db/Schema.php:674)
#0 /home/craft/www/craft/vendor/yiisoft/yii2/db/Command.php(1298): yii\db\Schema->convertException(Object(PDOException), 'DROP TABLE IF E...')
#1 /home/craft/www/craft/vendor/yiisoft/yii2/db/Command.php(1093): yii\db\Command->internalExecute('DROP TABLE IF E...')
#2 /home/craft/www/craft/vendor/craftcms/cms/src/db/Migration.php(316): yii\db\Command->execute()
#3 /home/craft/www/craft/vendor/craftcms/cms/src/migrations/m190617_164400_add_gqlschemas_table.php(18): craft\db\Migration->dropTableIfExists('{{%gqlschemas}}')
#4 /home/craft/www/craft/vendor/craftcms/cms/src/db/Migration.php(52): craft\migrations\m190617_164400_add_gqlschemas_table->safeUp()
#5 /home/craft/www/craft/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up(true)
#6 /home/craft/www/craft/vendor/craftcms/cms/src/db/MigrationManager.php(153): craft\db\MigrationManager->migrateUp(Object(craft\migrations\m190617_164400_add_gqlschemas_table))
#7 /home/craft/www/craft/vendor/craftcms/cms/src/services/Updates.php(225): craft\db\MigrationManager->up()
#8 /home/craft/www/craft/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(510): craft\services\Updates->runMigrations(Array)
#9 /home/craft/www/craft/vendor/craftcms/cms/src/controllers/UpdaterController.php(203): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db')
#10 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#11 /home/craft/www/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /home/craft/www/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /home/craft/www/craft/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('migrate', Array)
#14 /home/craft/www/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('migrate', Array)
#15 /home/craft/www/craft/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('updater/migrate', Array)
#16 /home/craft/www/craft/vendor/craftcms/cms/src/web/Application.php(646): craft\web\Application->runAction('updater/migrate')
#17 /home/craft/www/craft/vendor/craftcms/cms/src/web/Application.php(223): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#18 /home/craft/www/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /home/craft/www/public/index.php(27): yii\base\Application->run()
#20 {main}

@khalwat
Copy link
Collaborator

khalwat commented Jun 4, 2020

Yes, this is an error from a Craft CMS migration -- I'd contact: support@craftcms.com

It is not related to SEOmatic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants