1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Incorrect Canonical URLs?

Discussion in 'XenForo Questions and Support' started by planetzu, Dec 24, 2013.

  1. planetzu

    planetzu Member

    I was checking auto-generated canonical URLs for a thread that spans to 5 pages. This is what I found while checking the source code of the pages:

    Canonical URL for Page 2:
    Code:
    <link rel="canonical" href="http://sitename.com/threads/topic.14/page-2" />
    Canonical URL for Page 3:
    Code:
    <link rel="canonical" href="http://sitename.com/threads/topic.14/page-3" />
    Canonical URL for Page 4:
    Code:
    <link rel="canonical" href="http://sitename.com/threads/topic.14/page-4" />
    I could be wrong, but isn't it true that a Canocial URL is the main URL of the post? In which case, all Canonical URLs should point to "http://sitename.com/threads/topic.14/" and not to individual page URLs like http://sitename.com/threads/topic.14/page-2, page-3, page-4 etc.?
     
  2. planetzu

    planetzu Member

    Okay, I just realized that canonicals for individual URLs. So no worries. Thank you.
     
  3. Mr Lucky

    Mr Lucky Well-Known Member

  4. planetzu

    planetzu Member

    Thanks Mermaid, that's an excellent suggestion. But I am not sure how to include that in the forum as the article suggests that the first page should contain rel="next" and the 2nd page and other pages thereon should contain rel="prev" and rel="next".

    So the rel="next" would need to be generated dynamically if the said thread were to have a 2nd page.

    Do you have a PHP code that can achieve this?
     
  5. Mr Lucky

    Mr Lucky Well-Known Member

    I just had a look at the source code, and I believe this is already happening!
     
  6. planetzu

    planetzu Member

    lol I had no idea this was already there. Thank you for looking this up.
     

Share This Page