Last updated September 1, 2013. Created by batigolix on June 14, 2013.
Edited by scflmark, ifrik, LeeHunter, wusel. Log in to edit this page.

The Link module provides one or several fields for storing links. It supports additional link text titles and display settings.
Drupal 8: The Link module is a core module that only allows external links. Internal links can be added with the core module Entity Reference.
Drupal 7: The link module allows external and internal links. It does not allow adding links to a menu or navigation.

Drupal 8

Installation: Link is part of Drupal core and can be enabled from the Extend page (admin/build/modules).
Input format: The Link module only allows external (i.e. absolute) links. Links can include anchors or query strings.
Validation: Links must include the web protocol (http:// or https://) in order to validate. Validation takes place after filling in the field. Other scheme names (e.g. ftp, git etc.) are not supported.
Link texts: Link texts (called "Link titles" in D7) can be added to each URL. Whether this is allowed or required can be set in the field management. Placeholder text can be added to appear in the fields before the user adds their own content.
Display settings allow displaying either the link text or the URL, and the number of characters at which the link text should be trimmed.
No follow:The rel="nofollow" option notifies search engines that the link should not be followed. (See Wikipedia for details.)

Drupal 7 and earlier

Installation

Link is a contributed module that can be installed and enabled as described in the Drupal 7 documentation.

Configuration

The Link module provides one or several fields for storing absolute and relative links (often described as external and internal links or URLs). It supports additional link text titles, site wide tokens for titles and title attributes, target attributes, CSS class attribution, static repeating values and input conversion.
Link titles for URLs can be made mandatory, set to appear instead of URLs, optional (default), or left out entirely. If no link text title is provided, the trimmed version of the complete URL is displayed.
The target attribute should be set to "_blank", "top", or left out completely (checkboxes provide info).
The "rel=nofollow" attribute advises search engines to not follow the link. More info is available on Wikipedia.

Input formats for D7

The Link module supports absolute and relative links - often described as "external" and "internal" links. Links are validated during the saving of the node.

  • Absolute links Complete URLs (e.g.http://example.com) are displayed as such (e.g. http://example.com). The web protocol (e.g. http:// or https://) must be included, otherwise the link will not validate.
  • Relative links are input without the domain name and without a preceding slash (e.g. admin/build). These are then converted to a URL link (e.g. http://example.com/admin/build) or - where applicable - to the URL alias (e.g. http://example.com/project/link for node/74971).
  • Link to the front page: <front> results in a link to the front page of the site, as it is set under 'Site information' or by a contrib module.
  • Anchors and query strings may also be used

Output and Theming

The default output of a field 'My new link' with a url [URL], link text or title [Title] and a [target_value] is
<div class="field_my_new_link" target="[target_value]"><a href="[URL]">[Title]</a></div>.
Theming: The Link module is mainly a data storage field in a modular framework, therefore the theming and output depends on the site builder and the settings in other modules.
Many Drupal modules control the output of fields and handle rules, user actions, markup dependencies, and can vary the output in different scenarios.
Useful modules for this purpose include Views, Display Suite, Panels, etc.

References

Issue queue for bug reports and support requests

Useful blog posts that show creative uses of the Link module, or modules useful in conjunction with the Link module:

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.