Closed icreatestuff closed 1 year ago
For now, I've ended up using a custom SEO meta template so I can override those tags using this instead {{ url(craft.app.request.fullPath) }}
to remove any query strings from the URL. If there's a more elegant approach or a way to only exclude the ?token parameter but retain any other params that may exist I'm all ears.
Thanks for jumping on a fix for this so quickly @Tam really appreciated it.
It looks to be working pretty well for my use case so far, the only thing I'm wondering about is that my URLs are now left with a lonely ?
at the end e.g. https://test-site.ddev.site/my-entry-page?
. Is there a way to have that removed if there are no query string parameters left having removed the token
parameter?
Thanks
Description
We have a site that uses Ether SEO and the full-page caching Blitz plugin.
When Bltz is generating the cache it adds a token parameter to the URL which is being saved to the og:url and twitter:url meta tags within the SEO meta template because they use
{{ craft.app.request.absoluteUrl }}
. Based on this discussion on the Blitz repo and the warning provided in the Craft 4 class reference docs for this method it seems this isn't recommended.The result of having the
?token=...
parameter cached to those SEO tags is that the canonical URL that Facebook and Twitter/X are using is incorrect and results in no preview data (title, image description etc) being pulled through.Is there an alternative to
{{ craft.app.request.absoluteUrl }}
that can be used?Thanks
Additional info