Convert Inline Words to Links using Word Link Module in Drupal 7

The Word Link module is a great time saving tool because it allows you to store repetitive words and links in Drupal. For example, if you write a lot of articles about Drupal and want the word Drupal to appear as a link in your content, then use Word Link.

Of course, you could manually convert a word into a link, but by using Word Link all you have to do is define the word once and the module does the rest.

In this tutorial, I’ll show you how to define words as well as how to import and export them.

Getting Started

Simply download Word Link and enable the “Word Link” and “Word Link exchange” module.

If you use Drush, run the following command:

$ drush dl word_link

How to Define Words

The first obvious thing we need to do is add in some words.

1. Go to Configuration -> “Word Link” (admin/config/content/word-link) and click on “Add new word”.

2. Add in a few words like Views, Drush and Drupal. Also, add a URL to each word.

Fig 1.0

When you define a word the only fields that are required are the “Word/Phrase” and “URL”. You can also configure if the word is case sensitive and define a URL title. You can control which page the word is converted on by adding page URLs to the “Show links on specific pages” text area field.

Configure Word Link

Now that we have created a few words, we need to configure Word Link and choose which fields should be processed. If the module finds a defined word, it’ll appear as a link.

1. Go to Configuration -> “Word Link” (admin/config/content/word-link) and click on the Configuration tab in the top right corner.

2. Click on the Articles field-set and select Body from the multiple drop-down list, and click on Save.

Fig 1.1

All the other configuration options are pretty much self-explanatory. However, one option I want to draw your attention to is the “Convert limit” configuration.

Fig 1.2

This option allows you to define how many instances of a particular word will appear as a link. So if it’s set to 0 then all words will be links. But if it’s set to 1 only the first instance of a word will be converted.

Test Words

Go ahead and create a test piece of content to make sure the words are processing correctly. If everything has been setup properly, you should see a bunch of links within the content area of the page.

Fig 1.3

Import and Export Words

Word Link ships with a sub-module called “Word Link exchange” and its sole purpose is to offer import/export functionality. Words can be imported via a CSV file or you can import directly from any taxonomy vocabulary.

The import page can be accessed by going to Configuration -> “Word Link”, once there click on Import.

If you want to import taxonomy terms, then simply select the vocabulary from the “Import from taxonomy” field-set and click on Import.

Fig 1.4

Another option, if you want to import words using a CSV file then add the file to the “CSV file” field and click on Import.

Fig 1.5

Below is how the CSV file should be formatted:

Drush;1;;Drush title;word-link;0;""

Exporting words out of Word Link is very easy. Just click on the Export tab and choose how you want the CSV exported and then click on Export.

Fig 1.6

If you have any questions, please leave a comment.

5 thoughts on “Convert Inline Words to Links using Word Link Module in Drupal 7”

  1. Thanks for the article. I am thinking about using the module in a project, but I was wondering what would happen in the following case:

    Imagine you defined ‘Reef’ as a Wordlink. In an article you write about the ‘Great Barrier Reef’, which is already linked to somewhere.

    Will this result in Great Barrier Reef ?

    1. I did a quick test, and it looks like Word Link ignores words that are already part of a link, which is good.

      If the word “Reef” is already a link, then the module should ignore it.

  2. thanks! I m glad you understood where I was getting at inspite the conversion of the hmtl tags in my first message. Thank you for the help, I will definitely use the module.

  3. Great tutorial and module. However, will be nice to have an idea on how we can relate a set of links with pages . for exemple, in views, context will give you the ability to create several pages on the fly by aplying %keyword/%keyword… would be nice if one could automatically link words links path with these paths…
    Best regs

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top