Link module overview
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 fornode/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:
- Creating an embedded video or audio player for a link field
- Filter allowed protocols module This module allows users to change protocols set by Drupal to include new protocols such as Skype. For reference, the default protocols are: 'ftp', 'http', 'https', 'irc', 'mailto', 'news', 'nntp', 'rtsp', 'sftp', 'ssh', 'tel', 'telnet', and 'webcal'.
- Advanced Link module - Adds a new widget for autocomplete functionality, and allows filtering the type of links allowed.
- Link Favicon Formatter module - Allows changing a link's formatting to display the favicon of the URL alongside the link.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion