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
Fixing canonical in SEF plugin #4612
Conversation
Tested and it works. Though, most rel canonical vanish in my set up |
That is the way it is supposed to be. If you are already on the canonical URL, you don't need to display it. |
See other canonical issue: |
Please, on a default Joomla install with test sample data, can you explain when we should get a canonical and when not? |
You should get a canonical if for example you are on a non-SEFed URL and SEF is enabled. In that case you should get the SEF URL as canonical. In theory, you should also get a canonical URL when you access /component/content/article/42-something, which should then point to the right URL (/answers-to-the-universe/42-something) but our routing system does not work in such a way right now. Canonical URLs should definitely not show up ALL the time and they should not show up when the current URL is what Joomla thinks should be the canonical URL. All that said: On a default Joomla install with test sample data, you should never get a canonical URL. |
hmm, with or without your patch, I get this on a multilang site:
|
That is rather another issue, but doesn't really matter that much, since Google will interpret that relative to the current domain. And even if it shows up as the same URL and all the time, that wouldn't be a real issue either. My main concern with this PR is, that we remove the additional JRouter::parse() run here, since JRouter::parse() should only be called once per page load. |
Tested and it works. |
it works as expected - great. |
Looks like there are several good tests. I'm moving this to RTC to be reviewed by a committer. By the way, a useful article on rel=canonical links: |
Google says not to use relative, but absolute path: https://support.google.com/webmasters/answer/139066?hl=en#2
|
It didn't worked for me (j3.3.6): |
The SEF plugin right now ALWAYS adds the canonical tag to the header. At the same time it is written extremely inefficient. Going through this step by step:
This PR fixes all these issues.