Looking for an updated version of this tutorial? Check out “Create Internal Links using the Linkit module in Drupal“.
What is the best way to link from one piece of content to another on the same site? You could hard cade URLs in the body of the text or you could use the Linkit module. The Linkit module gives you a pop window with an easy interface which allows you to search for content using an autocomplete field, then simply insert a link into a text area.
Linkit’s configuration options are managed as “Linkit Profiles”. This is very powerful because it allows site builders to build different profiles based on a user’s role. For example, suppose you have two roles, one called “publisher” and another called “editor”. Users with the “publisher” role can only link to other nodes, where as users with the “editor” role can link to everything (nodes, files, etc). All you have to do is go to
admin/config/content/linkit and create the custom profiles. Linkit creates a default profile when you install the module. We’ll use this profile throughout out this article.
Next, go to the Wysiwyg profiles and enable the “Linkit” button.
Now that everything is configured you should see the Linkit button on the Wysiwyg editor.
Simply click on the button, then search for content using the “Search content” field.
If you insert a link without selecting any text, the link will be used for the text which doesn’t look that nice.
To avoid this just select a bit of text before clicking on the Linkit button, then the selected text will be used for the link.
Finally, because Linkit module stores configuration as profiles, you can export profiles into features.