The site's root URL will always end in a trailing slash because it'll either be a hostname root (http://example.com/) or run from a directory (http://example.com/drupal/). As a result, when using "[site-url]" as the canonical URL token it should not strip the trailing slash as it normally does.

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1.2 KB

Patch supplied that does not run trim($path, '/') when the default value is "[site-url]".

damienmckenna’s picture

StatusFileSize
new1.19 KB

Alternatively, should it just check to see if the current site is the homepage?

damienmckenna’s picture

StatusFileSize
new1.23 KB

Or both? =)

damienmckenna’s picture

Issue tags: +v6.x-1.12 blocker

Lets fix this for v6.x-1.12.

dave reid’s picture

Why are we removing trailing slashes? We should just remove that code.

dave reid’s picture

Status: Needs review » Needs work

Oh I think the intent here may have been to prevent tokenized strings like '/node' from getting run through url(). If that's the case we should convert this to a ltrim() rather than the more greedy trim().

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new885 bytes

Something like this?

dave reid’s picture

yep that seems like the better option

dave reid’s picture

Reviewing this again, we'd probably actually want to skip if the URL is already absolute, as it's pointless running through url() again at that point. Something like:

  if (!empty($content['value'])) {
    $context['value'] = nodewords_replace_tokens($content['value'], $options);
    if (!menu_path_is_external($context['value'])) {
      $context['value'] = trim($context['value'], '/');
      $context['value'] = nodewords_url($context['value'], $options);
    }
    $tags['canonical'] = check_url($content['value']);
  }
damienmckenna’s picture

Status: Needs review » Needs work

This may need some work, given we've reverted everything back to the last changes on December 31st, 2009.

damienmckenna’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Issue tags: -v6.x-1.12 blocker

Bumping this to the 6.x-2.x branch which includes support for Tokens, the remaining 6.x-1.x branch does not.

damienmckenna’s picture

Status: Needs work » Postponed

Marking all v2 issues as postponed while v1 is finished off.

damienmckenna’s picture

Issue summary: View changes
Status: Postponed » Closed (won't fix)