In my TYPO3 site, we create news in german and translate it to english. On my search for canonical urls for the news component, I found these helpful answer here: https://stackoverflow.com/a/53836388/20815643
This solution works fine but not completly free of problems.
I use the code and the 2 lines routeFieldPattern
and routeFieldResult
create links like this:
abc.de/news/hallo-welt-2022-1763
This works without translation and the canonical URL are correct. But if I translate my news, then the correct uid have to be 1764, but the router create a link with the original news uid (1763):
abc.de/en/news/hello-world-2022-1763
The correct link should be this:
abc.de/en/news/hello-world-2022-1764
I looking for an solution to handle also the language id in the router config, but I stuck. How can I use the language id to get full correct link?
I search for more parameters to the routeEnhancer, but found nothing.