Linktonode should create stable links

aexl_konzepto.net - February 13, 2008 - 11:17
Project:Link to content
Version:5.x-1.7
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

- create link
- in my installation the link looks like /content/mycontenttitle
- rename mycontenttitle
- link is broken
wouldnt it be better to insert links like /node/177, so they wont change?

#1

stBorchert - February 13, 2008 - 14:27

Hm, nearly one and a half year ago I've changed this to insert the path alias instead of the nid :-) (see #80105).
You can change the behaviour by doing the following modifications:
[linktocontent_node.module]
line 211: function _linktocontent_node_get_nodes()
$obj->href = url('node/'. $node->nid);

    $obj->href = 'node/'. $node->nid;

Well, seems to be a config-option in the next version :-).

#2

aexl_konzepto.net - February 13, 2008 - 14:58

this is kind of funny...
thanks for instant help!

#3

giggler - February 13, 2008 - 20:00

oops, I just tested this. While it works to produce stable link. It creates a problem when you use pathauto. This will create linking to /node/1 from content area and /alias-name from menus, so search engines will see it as duplicated content (risk of being penalized).

Is there a way to make it so that it looks to /node/1 and instantly produce the pathauto link of /alias-name? This probably requires code within TinyMCE to read . I don't know exactly, but it will look to the code for node 3 and instantly convert it to the appropriate alias title. It will not be hard coded into TinyMCE... That would be the solution if it's something that can be done.

#4

aexl_konzepto.net - February 14, 2008 - 10:50

hey giggler,
spiders penalize sites when using content aliases?
i cant imagine that. (they might index only once, thats easy)
do you have some more-than-rumour reference???

#5

giggler - February 14, 2008 - 19:54

It's not when using content alias. It's ok to use it. If you create one and use it sitewide, then it's consistent, but once you link it to node/1/ and node/alias-name, spiders may see that as duplicated content.

This is straight from google site...and I put "risk"...doesn't mean it will happen, but also means that mistakes can happen if it's based on algo or changes in algo or I don't know how other SE works. If it's human monitored, then the site will not have the risk. Google said they do a pretty good job at choosing one, but I also want to make sure they index the content/alias-name and not the node/1, so don't worry about the penalized part since you're right, it is likely not going to happen if you're not doing it to fool SE and they will choose one version.

For those interested in just reading up on it:

http://www.google.com/support/webmasters/bin/answer.py?answer=66359
http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=35769

#6

dagomar - March 27, 2008 - 21:43

I didnt know about this isue, so i checked it. In my installation the same issue. However, when I clear the cache after renaming the node, linktonode takes the right path.

#7

trond7 - May 6, 2008 - 10:46

My personal view is that this module should use Permanent URL by using nid instead of using Nice URL alias in the editor mode and then have an filter that show the NiceURL alias to the end user (and search engines).

In this way it also is possible to change a node's title, or even change how pathauto is generating new aliases without making any dead links in published content.

So use stable nid I editing and transform to niceURL(alias) by using a filter or some kind of function prior to showing node to the end user.

#8

stBorchert - May 6, 2008 - 12:31

My personal view is that this module should use Permanent URL by using nid instead of using Nice URL alias in the editor mode and then have an filter that show the NiceURL alias to the end user (and search engines).

This is *not* possible. The module just retrieves the node information (with both, nid and path) and inserts a link into the node content (you can only select in code whether to insert the nid or the path: #1). The representation of the link is done by the node's display filter so it always should(!) display the path if linktocontent inserts the nid.

@edit: I've checked it: unfortunately my installation of d5 does not transform links like "node/1" to their paths.

#9

komilo - May 14, 2008 - 16:54

Hi,
I think trond7 idea can be possible. Linktonode should always use nid to form the links, and site admins should use additional module such as path filter (http://drupal.org/project/pathfilter) to display nice url alias to the end user. The path filter module transforms links like "internal:node/nid" into the nid node path using its path alias if found, like /content/alias-name.
I suggest all this to be config options in the next version:
- choice between url alias paths and nid paths, for those who don't want to install additionnal module
- custom path pattern, by using tokens like [nid], [alias],... as in the pathauto module configuration; the goal is to allow the admin enter something like "internal:node/[nid]" so he can use a filter module like path filter

 
 

Drupal is a registered trademark of Dries Buytaert.