Fork me on GitHub
Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
Critical: Update to 2.1.8, released 15 Jan.

Vanilla shows wrong canonical URL for categories?

edited March 2012 in Vanilla 2.0 Help

The canonical URL for categories is broken. It shows the same canonical URL: or — for all categories!

Besides that page doesn't exist — it gives a 404 error.

Is this a bug? How can this be fixed? Hope someone can chip in. Thanks.

@Todd ?

Best Answers


  • UnderDogUnderDog Moderator
    edited March 2012

    DUDE! You only posted this question a couple of hours ago and now you want already attention from a specific person?

    Let your question live in the discussion list for a while! After you haven't gotten any response for a couple of days, THEN ask a specific person.

    And the first response for you is (abacadabra):

    Learn how to SEARCH in the forums!

    (then also search for forum etiquette, there's a whole thread about it)

  • edited March 2012

    @UnderDog :

    1. Calm down.

    2. First I searched. I couldn't find any solution.

    3. I posted my question. As always, I started searching for a solution again.

      • came across a thread reporting the same issue, but there were no replies.
      • Saw some other thread, where the user believed it to be a bug, and @mentioned Todd. He jumped in solved the issue once for all.

    So, as it should have been obvious by now, your analysis is pure bullsh!t. So stop judging and try to help. This is a community. You are a moderator, and that doesn't mean... well, you should have realized it by now.

    And if you actually know that 'there's a whole thread about it', as a moderator didn't you have the minimum courtesy to share the link? Damn, you have made my day!

    One suggestion: maintain a friendly tone with others. Ones asking a question here need help, not your silly judgements. :)

  • aeryaery Gtricks Forum in 2.2 :) ✭✭✭

    I second @badlearner 's opinion.

    Vanilla is sweet & support is great, to encourage volunteers, please donate.

  • @Todd : If there's a file (on GitHub) that I can refer to for changes, it would be very helpful. I will gladly post the fix here for everyone.

  • ToddTodd Chief Product Officer Vanilla Staff

    And as an fyi @badlearner, Any canonical urls that are specifically overridden will always be in the controllers with a call to $this->CanonicalUrl(...).

  • Yes, got it. Thank you.

  • edited March 2012

    @Todd : Did you push the entire file or just that line? Here's the thing:

    Using the entire file causes this error on Vanilla

    Fatal error: Call to undefined method Gdn_Theme::Section() in /home/xxx/public_html/forum/applications/vanilla/controllers/class.categoriescontroller.php on line 220

    In another scenario...

    Adding this line (replacing the existing one):

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

    And removing this:

    $this->CanonicalUrl(Url('/categories', TRUE));

    Completely removes the canonical meta tag from the source. So, in a way, there's no fix yet (unless I am doing something seriously wrong). Thought I should let you know.

    EDIT: Using the file you just pushed on GitHub gives an error (see above).

  • @badlearner, have you had any success this is the same problem I have.

    Is this pretty much the solution.

    `Adding this line (replacing the existing one):

    $this->CanonicalUrl(Url(ConcatSep('/', 'categories/'.GetValue('UrlCode', $Category, $CategoryIdentifier), PageNumber($Offset, $Limit, TRUE, FALSE)), TRUE));`

  • @peregrine : As you can see I have pinged @Todd about it, and he hasn't replied yet. And no adding that line alone doesn't seem to fix anything.

    I believe that the changes made in that file (/vanilla-root/applications/vanilla/controllers/class.categoriescontroller.php) are streamlined to work with Vanilla 2.1*, and apparently, not Vanilla's current stable v2.0.18.3. :(

    So, yeah I am waiting for a fix too.

  • ToddTodd Chief Product Officer Vanilla Staff

    Did you remove the second call to Canonical Url? I tested and pushed that very fix in the 2.0.18 branch.

  • @Todd : Oh yes, I did. Please see this comment of mine, you'll see exactly what I did.

  • ToddTodd Chief Product Officer Vanilla Staff

    Okay I think I know what's happening here. When the canonical url matches the current url then it doesn't show up. Canonical urls only show up when there's a difference.

  • Todd said:
    Okay I think I know what's happening here. When the canonical url matches the current url then it doesn't show up. Canonical urls only show up when there's a difference.

    But canonical URLs are supposed to show up in the source of every page right?

    In a similar instance, Lincoln said that the issue of breadcrumbs not showing up in a theme has been fixed in v2.1. He also referred me to a file. But when I made the changes on my Vanilla v2.0.18.3 forum, breadcrumbs weren't still showing up.

  • lucluc ✭✭

    Todd just told you if the canonical is the same as the url it's served from, it doesn't show up.

    This one was tested.
    Otherwise, you can expect any changes from the upcoming 2.1 to be work, some are linked to other changes in the code too.

  • edited March 2012

    @luc : One last question - - do you think it's a good idea to start my public-facing forum using the unstable master version? I am willing to update my theme everyday with the latest changes.

    The thing is, Vanilla has too many issues (at least for me) to use it. Just looking for some advise here.

  • Okay, got it. Thanks Todd!

This discussion has been closed.