Hello,
I am using the default Quark theme on a multilingual site.
Unfortunately, I have some pages that I do not plan to translate. Fallback language (German) works well, no issue there. But, the canonical tag is automatically generated and still points to the missing language implementation of that site. If you follow that link, you are directed to the fallback version again.
This means that the same content is reachable under two canonical addresses which should not be the case.
That is why I trief to override the canonical link by providing my own in frontmatter of this file. Unfortunately, the canonical link is built using the language reference again. If I try to override the canonical URL with an absolute URL, I get a canonical link with base URL + language + my absolute link, something like https://example.com/en/https://example.com/correct/address
.
In base.html.twig
<link rel="canonical" href="{{ page.url(true, true) }}"/>
This line seems to build the link and it does not give the correct result. How would I have to rewrite that line in order to get the absolute URL if I provided one in frontmatter and the usual canonical URL if I did not provide an absolute frontmatter.
Alternatively, is there any other way to ensure that the canonical URL is correct?
As an example: Link does not have an english translation. It gets displayed in German, but canonical link is english. Here, I did not provide an absolute override URL.
Issue is certainly connected to this issue, but simply changing the method call to page.canonical()
did not help.
Thx