Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Why is the root Canonical URL three levels deep?

dan39dan39 New
edited February 2011 in Vanilla 2.0 - 2.8
If you install Vanilla in the root directory of a domain or subdomain, such as:

http://forum.mydomain.com/

...Vanilla sets the Canonical URL of your forum's homepage to be:

http://forum.mydomain.com/discussions/p1

So, Google thinks your forum's homepage is a third-level subdirectory. That's a problem. For instance, here's what Google sees for this forum:

http://google.com/search?q=vanilla+forum+discussions



It's impossible for Google not to think of your forum as a very deep page. Deeper directories do not rank as high in SEO. Even if you install Vanilla in the root directory, Vanilla still makes your homepage's Canonical URL three levels deep. In the eyes of a search engine, your homepage is not a parent of any of your content. And your homepage is just a deep link that links to all of your best content. It's all backwards.

How can one make it so that the Canonical URL for the homepage is actually http://forum.mydomain.com/ ?
Tagged:

Comments

  • judgejjudgej
    edited February 2011
    The page number (pN or &p=N) should be suppressed if N is one IMO. I've raised that as a bug a while ago, but no idea if anyone is looking at it. The same issue applies to the first page (and often the only page) of a discussion.
  • edited February 2011
    This was discussed before and maybe I don't understand vanilla structure enough but I can't see why the canonical URL can't point to the root without the P
  • dan39dan39 New
    edited February 2011
    It can be done. I was able to do it in a very hacky way, by simply editing the $this->CanonicalUrl in these core files:

    applications/vanilla/controllers/class.categoriescontroller.php
    applications/vanilla/controllers/class.discussionscontroller.php
    applications/vanilla/controllers/class.discussioncontroller.php

    For instance, to correct the CanonicalUrl in the class.categoriescontroller.php...

    if (PageNumber($Offset, $Limit, TRUE) == 'p1') $this->CanonicalUrl(Url(ConcatSep('/', 'categories/'.GetValue('UrlCode', $Category, $CategoryIdentifier), ''), TRUE)); if (PageNumber($Offset, $Limit, TRUE) != 'p1') $this->CanonicalUrl(Url(ConcatSep('/', 'categories/'.GetValue('UrlCode', $Category, $CategoryIdentifier), PageNumber($Offset, $Limit, TRUE)), TRUE));

    ...and to fix it in class.discussioncontroller.php:

    if ($this->Offset > 0) $this->CanonicalUrl(Url(ConcatSep('/', 'discussion/'.$this->Discussion->DiscussionID.'/'. Gdn_Format::Url($this->Discussion->Name), PageNumber($this->Offset, $Limit, TRUE)), TRUE)); if ($this->Offset == 0) $this->CanonicalUrl(Url(ConcatSep('/', 'discussion/'.$this->Discussion->DiscussionID.'/'. Gdn_Format::Url($this->Discussion->Name), ''), TRUE));

    ...and to fix the root directory, I simply changed line 74 of class.discussionscontroller.php to:

    $this->CanonicalUrl(Url('http://forum.mydomain.com/'));

    It seems that the root page is the only page generated by class.discussionscontroller.php that needs it's CanonicalUrl corrected. Pages p2, p3 and others typically don't need any CanonicalUrl correction since there aren't multiple ways to get to p2, p3. So, just forcing CanonicalUrl to the root directory on line 74 works fine.

    Pardon my awful syntax... I'm much better at front-end coding.

    Hopefully someone better at this than me can figure this out without editing core files.
  • jobbatamjobbatam Batam New

    @dan39 i have same problem with you.. do you have fix this issue?

  • I was wondering how to remove only the two "main pages" of every forum from the canonical , the /discussions and /categories slug in order to avoid google's deep brainy searches that always punish us >:)

  • x00x00 MVP
    edited May 2015

    I hate to break it to you but it is myth that google thinks in terms of direcories. Google knows what any good server guy knows, that url schemes are not really reprentative of directories much of the time (do you really think there is a physical file matching that address?). They are much smarter, and it would not serve their interest one bit to require things that could be easy to exploit.

    SEO world is plagued by myths.

    The whole point of a canatical urls it to tell what is canatical, otherwise there would be no point to it.

    Google's primary objective is relivance it not concenrned with the intracies of your server architecture. That is becuase people are conserned with relivance, which is the point fo a search.

    In fact even SEO friently urls, have decreasing importance, and a just something that looks nice. Google is quite capabale of seperating even ugly urls into component parts such as slug.

    grep is your friend.

  • R_JR_J Ex-Fanboy Munich Admin

    I don't know much about SEO, but I am convinced that if the slug would be that important, Vanilla and other forum scripts would optimize it. Look at some examples:

    vbulletin.com/forum/forum/vbulletin-sales-and-feedback/vbulletin-pre-sales-questions/414177-follow-vbulletin-on-google

    phpbb.com/community/viewtopic.php?f=466&t=2269196

    community.mybb.com/thread-169759.html

    I like especially the "/forum/forum" part, although "viewtopic 1234567" "thread 0815" are not bad either! :mrgreen:

  • xDaizuxDaizu New
    edited May 2015

    @x00 said:

    The whole point of a canatical urls it to tell what is canatical, otherwise there would be no point to it.

    I must admit i can never tell when my URLs are... canatical... :p

    Agree on the doesn't-matter-how-deep-it-is-if-its-reasonable-and-readable point.

    @judgej said:
    The page number (pN or &p=N) should be suppressed if N is one IMO.

    Agree!

  • canonical sorry.

    grep is your friend.

  • @x00 said:
    canonical sorry.

    :awesome:

  • R_JR_J Ex-Fanboy Munich Admin

    Oh - and I also love using Google as an example of how important the url is: support.google.com/webmasters/answer/answer.py?answer=35769

  • jobbatamjobbatam Batam New

    @R_J said:
    I don't know much about SEO, but I am convinced that if the slug would be that important, Vanilla and other forum scripts would optimize it. Look at some examples:

    vbulletin.com/forum/forum/vbulletin-sales-and-feedback/vbulletin-pre-sales-questions/414177-follow-vbulletin-on-google

    phpbb.com/community/viewtopic.php?f=466&t=2269196

    community.mybb.com/thread-169759.html

    I like especially the "/forum/forum" part, although "viewtopic 1234567" "thread 0815" are not bad either! :mrgreen:

    same with you, about seo..., but i think this is part of important point to vanilla.. no cms perfect for urls you show above, but we forward to better place right? :awesome:

    I am looking for a comparison of various forum CMS and decided to chose vanilla because I like the features in it. I am not an expert in coding, design and associated with it, just to give feedback :)

  • R_JR_J Ex-Fanboy Munich Admin

    @jobbatam said:
    but i think this is part of important point to vanilla.. no cms perfect for urls you show above, but we forward to better place right?

    I think you didn't get the point: changing the urls of Vanilla wouldn't make it better. It would change the way urls look like. Nothing more.

    If you want to improve SEO, you should do something SEO-related. If you like to have a faster car, you wouldn't start that by wearing a rally suit either...

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
    edited May 2015

    Hopefully, the days of SEO 'experts' is coming to an end.

    I have a relatively small site, and we make no effort to publicise or advertise (we have one link back from a related site), and have no SEO tweaking, and our site has got to 12th in Google for a search for 'west ham forum' (a not inconsiderable market, with over 4m results)

    That is down to the fact that Vanilla is clearly set up to be search engine friendly, and the fact that we have a lot of relevant content that gets updated daily by a group of regular users.

Sign In or Register to comment.