Canonical override missing in graphql response
Describe the bug
When a canonical override on a page entry is set, the gql response does not contain the rel="canonical" tag.
To reproduce
Steps to reproduce the behaviour:
- Set a canonical override in your page entry SEOmatic field
- query the page's seomatic with gql:
query page($uri: String) { seomatic(uri: $uri) { metaTitleContainer metaTagContainer } } - Have a look at the response.
- (optional): Set "Always include
canonicallinks regardless of environment" in plugins setting to true -> does not change the outcome. (environment in my case is manually set to live)
Expected behaviour
A correct canonical tag in the metaTagContainer
Versions
- Plugin version: 5.1.19
- Craft version: 5.8.20
Can you provide me with a screenshot of the SEO Settings field that has the Canonical URL override set?
@khalwat
And this entry is populated to all sites? Or is it a per-site entry? Just trying to get enough information to reproduce it here locally.
@khalwat this is a seomatic field, which was placed into a page (section). therefore you have access to the seo settings for each page individually, which works fine for other fields inside the seomatic field (e.g. title, description).
So if i have two pages, i can overrride the titles etc. on each entry individually. this works fine, except for the canonical url
Do you have anything configured in the URL Override setting in SEOmatic?
SEOmatic -> Plugin Settings -> Advanced -> Site URL Override
So I think this isn't actually a bug. The canonical URL is not contained in the metaTagContainer but rather the metaLinkContatiner (because it's a <link rel="">).
So try:
query page($uri: String) {
seomatic(uri: $uri) {
metaTitleContainer
metaTagContainer
metaLinkContainer
}
}
I tested it with the URL being overriden via an SEO Settings field in and entry, and it worked as expected for me.