Advertising sustains the DA. Ads are hidden for members. Join today

Link module overview

Last updated on
30 November 2016

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Installation

The Link module 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, set to be 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, respectively. 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/modules). These are then converted to a URL link (e.g. http://example.com/admin/modules) 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 contributed 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, and others.

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:

Help improve this page

Page status: No known problems

You can: