Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Status: Active » Closed (works as designed)

It does already, e.g. on a clean install it outputs the following for the fourth node:

<link rel="shortlink" href="/node/4" />

If you're not seeing this then you've got a module installed that's changing it.

eule’s picture

i have clean install

eule’s picture

Status: Closed (works as designed) » Active

i check again my site. i have 3 nodes on it every node has cleanurl in the shortlink tag

<link rel="shortcut icon" href="http://example.com/core/misc/favicon.ico" type="image/vnd.microsoft.icon" />
<link rel="edit-form" href="/node/2/edit" />
<meta name="Generator" content="Drupal 8 (http://drupal.org)" />
<link rel="canonical" href="URL-ALIAS" />
<link rel="shortlink" href="URL-ALIAS" />
<link rel="version-history" href="/node/2/revisions" />

i have for D8 not a Module installed ..sry ..just a clean installation

longwave’s picture

Bug confirmed. The code in question is in node_page_view():

drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE);

According to the documentation, url() is supposed to accept 'alias' => TRUE to assume the path is already aliased. In this case $uri['path'] is 'node/1', but the return value is still aliased, so this 'alias' option does not seem to be working.

longwave’s picture

Status: Active » Needs review
FileSize
1.95 KB
1.04 KB

The PathProcessorAlias class always aliases the path, ignoring the 'alias' option when set. The attached patch fixes this, including tests for both the canonical and shortlink URLs.

This should also fix #2017087: Term shortlink link relation is broken

longwave’s picture

Title: shortlink is not using node/nid » shortlink is not using node/nid or taxonomy/term/tid
FileSize
3.51 KB
2.61 KB

Added more tests to prove #2017087: Term shortlink link relation is broken was also broken and is now fixed.

eule’s picture

hi, this is not fixed for now..i try the latest dev. shortlink has cleanurls

longwave’s picture

This is not yet fixed in -dev. You need to apply the green patch from comment #6 or the similar patch from #2096135: PathProcessorAlias ignore 'alias' => TRUE

-enzo-’s picture

Status: Needs review » Closed (duplicate)
eule’s picture

September 11 -> dawehner on September 23 .-)
@longwave thanks for your fixes and help!