Drupal Links in Content

Most of the sites that Coda builds using the Drupal CMS use Friendly URL Aliases that are Search Engine Optimized. Friendly URL Aliases are automatically generated from the page Title field and will change whenever the Title field is changed. Since the Friendly URL can change it is important to use a System URL in content so that they will always work even if the page title has changed. Drupal will automatically rewrite the System URL to a Friendly URL in content so the Friendly URL functionality will remain in effect.

Drupal System URLs<

By default Drupal uses a query string for content page URLs that follows the pattern:

http://www.codamoda.com/index.php?q=node/215

Most web servers will automatically serve the index.php file by default so the URL can also look like:

http://www.codamoda.com/?q=node/215

These URLs are not easy to remember, are not descriptive of the content, and are difficult to type in manually. To improve the format of the URL Drupal has the option of Clean URLs that rewrite the orginal URL into a nicer format.

http://www.codamoda.com/node/215

The important part of this URL is node/215 which is the System URL.

Friendly URL Aliases<

Friendly URL Aliases take this process a step futher and generate a natural language URL from the Page Title. The Friendly URL is easier for visitors to remember, easier to type in manually, and provides better Search Engine Ranking. Search Engines typically pick up on the words used in URLs and give a better ranking for the page if the words are in the URL, Page Title, and Page Contents. For example the page you are currently reading has an automated Friendly URL Alias

http://www.codamoda.com/drupal-guide/drupal-links-in-content

Since the Friendly URLs can change we should always use the System URL when creating links in content.

Automatic Drupal System Links<

Coda highly recommends the Automatic Drupal System Links feature that greatly simplifies the creation of internal system links in content. If your site has this feature installed you will see a button on the WYSIWYG editor that looks like Automatic Link Button. Adding a link with this button is very easy:

  1. In the WYSIWYG editor select the text you wish to apply the link to.
  2. Click on the link button Automatic Link Button
  3. A window will open with Insert Link helper.
  4. Start typing in the Title of the page you wish to link to in the Link to field. This field is case sensitive so Drupal Links in Content is not the same as drupal links in content.
  5. A drop down list of matching content items will appear.
  6. Select the content item from the list.
  7. Click the Insert button.
  8. The Insert Link helper window will close and the link is created.

Manual System Links<

If your site does not have the automatic link button Automatic Link Button it will use the standard link button Standard Link Button. When creating links using the standard link button we have to be more vigilant and remember to always use the System URL.

Finding the System URL<

The easiest way to find the system URL is to follow these steps:

  1. Make sure you are logged in using and administrative account.
  2. Navigate to the page you wish to link to.
  3. If you see an Edit button click on it.
    1. The current URL should now look like http://www.codamoda.com/node/126/edit.
    2. We remove the domain name http://www.codamoda.com/ and /edit from the URL to get the system URL. In this case it would be node/126.
    3. So node/126 is the system path to use for a link.
  4. If you do not see an Edit button then we use the relative path. For example if our URL is http://www.codamoda.com/the-new-page then we remove the domain name http://www.codamoda.com/ and we are left with the-new-page.

Manually Create an Internal Link<

Now that we know the System URL we can manually create the link.

  1. In the WYSIWYG editor select the text you wish to apply the link to.
  2. Click on the link button Standard Link Button
  3. A window will open with Insert Link helper.
  4. Type in the System URL into the Link URL field.
  5. Click the Insert button.
  6. The Insert Link helper window will close and the link is created.

Incorrect Internal Links<

All of the following link examples are incorrect when used to link to internal site content. In all the examples the correct Internal Link would be node/215

http://www.codamoda.com/node/215

Internal links should not have the domain name in them. In this case the domain is www.codamoda.com

http://74.53.250.247/node/215

IP numbers should never be used in links. If linking to an external web site then the Fully Quanlified Domain Name FQDN should be used. Internal Links should not use the domain.

drupal-guide/drupal-links-in-content

Friendly URLs can change and should not be used.

node/215/edit

Links to an edit page will not work for web site visitors.

/node/215

The "/" at the beginning makes this a fixed link to the site root. In most cases this will not be a problem but sometimes it can and therfore should be avoided.

http://node/215

The http:// at the beginning of this URL will cause it to fail because http:// can only be used in front of a domain name. This URL will actually cause the look up of the www.node.com domain.

More Info about Links<

2 comments

What module adds the ADSL feature?

This is a really great tutorial for someone who is already using a pre-built drupal site, but for those of us who are trying to achieve the effects you describe, can you please add which WYSIWYG editor you chose, and which module adds the Automatic Drupal System Links feature to that editor?

It would also be nice if you could add an overview of the configuration required for that module. I'd imagine it involves both a filter that needs to be applied to the text format, as well as a plugin which needs to be configured in your WYSIWYG editor settings.

I'd love to know more,
Jen

Jen Lampton wrote 11 years 50 weeks ago
gbrandys's picture

Modules used

Hi Jen, We recommend the following modules:

gbrandys wrote 11 years 3 weeks ago

Add your comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
 ME8@H8MM@    .d5H8@b.    .d9SMHb.    d9S@    ME8@H8MM@  
E8@ dM5P YHEb dH8P YE8b d9SEM E8@
9H@ 5MH YEMb. dMHP 89M 9H@
SE89@5Sb. .d98P "Y@@H@H" 9EM SE89@5Sb.
"YS@b .od99@P" .d5P""YSb. MH9 "YS@b
5HS d8SP" @@M E9E ES5 5HS
YM5b d@SP SH8" Y8Sb d8@P HEM YM5b d@SP
"Y5SMEP" 55@EE8E5H "YE899P" @8@MHSH "Y5SMEP"