Link

quicksketch - July 22, 2006 - 07:25

A CCK content field which lets you add a complete link to your content types; including URL, title, and optionally a target attribute.

Requires the content module (CCK).

The link module is a one-stop content link "field" type for CCK. It provides three fields to an authorized user:

  • URL (textfield)
  • Title (textfield)
  • Open New Window (checkbox)
  • Add rel=nofollow attribute

"Title" and "Open New Window" can be optionally enabled or disabled when setting up the content field.

If you were to create a field named 'My New Link', the default display of the link would be:

<div class="field_my_new_link" target="[target_value]"><a href="[URL]">[Title]</a></div>

where items between [] characters would be customized based on the user input.

Installation

  • Drop the entire link module directory into your 'modules' folder
  • Enable the module from the Administration area modules page (4.7: admin/modules, 5: admin/build/modules)
  • Create or Edit a CCK content-type and add a new field of type link (4.7: admin/node/types, 5: admin/content/types)

Configuration

Configuration is only slightly more complicated than a text field. Titles for links can be made required, optional (default), or left out entirely. If no title is provided in an optional setup a trimmed version of the complete URL is displayed (currently no more than 80 characters).

The target attribute may be set to _blank, top, or left out completely.

The rel=nofollow attribute prevents the link form being followed by certain search engines. More info at Wikipedia.

Data Entry

Link recently added support for internal and external URLs. URLs are validated on input, here are some examples of data input and the default view of a link:

http://drupal.org => http://drupal.org
drupal.org
=> http://drupal.org
<front>
=> http://drupal.org
node/74971
=> http://drupal.org/project/link

Anchors and query strings may also be used in any of these cases, including:

node/74971/edit?destination=node/74972
<front>#pager

Theming

You can find more information on how to theme the output (and all other CCK fields) at the CCK Handbook on Theming Individual Fields

Another popular alternative is using Content Template Module, which allows you to output links (or other field types) in any variation using PHP code. Almost formatting desired can be accomplished using one of these two methods.

Help

If you have questions or trouble, please post to the issue tracker rather than the forum.

Releases

Official releasesDateSizeLinksStatus
6.x-2.1-beta42008-Apr-2016.36 KBRecommended for 6.xThis is currently the recommended release for 6.x.
5.x-2.12007-Oct-2114.45 KBRecommended for 5.xThis is currently the recommended release for 5.x.
4.7.x-2.02007-Apr-2513.52 KBRecommended for 4.7.xThis is currently the recommended release for 4.7.x.

Resources

 
 

Drupal is a registered trademark of Dries Buytaert.