Tutorial for Glossify module to create automatic links in Drupal

6 posts / 0 new
Last post
Tutorial for Glossify module to create automatic links in Drupal

I was looking at making links (external) from within the content on my Drupal site. I've looked at several modules including:
- Alinks
- Link Intelligence
- Glossify

and I was also thinking about doing it myself in PHP from within the theme.

So in the end I've chosen Glossify because it seems to be the one where there is most activity and it relies on Drupal's mechanisms such as taxonomy, nodes, comments and cck.. Since my content relies upon CCK fields, some such as Alinks simply don't work because they only use the $node->content but I'm not using standard drupal's cck fields display options, I'm manipulating the cck fields value from within the theme's node.tpl.php

So anyway, my tutorial is about how to create external links on some words, it should be easy but it is not because there is no clear documentation and when you just install Glossify you're on your own to understand it, I haven't found clear tutorials online that explain how to do that, so hopefully this tutorial will help you..

----

I'm going to explain you quickly the principle that you want to achieve, if you know Drupal that will be enough to know what to do and you won't need to read the rest of the tutorial..

So, the end result is that you have to create a new content type, call it "glossifylink" for instance. In the glossify options, select this content type as the "Target content types" and choose the method internal "Attach 2 additional fields to the selected Node types." and deselect "Make use of the title field of a node.".. Finally make sure that you add the Glossify filter in the input formats that you use on your site (in my case, Filtered HTML and Full HTML).
Now, when you want to create a link on some words, it's easy, simply create a new node of the type glossifylink, put anything in title and body, then see below you have two other fields under the Glossify menu, "Glossify Keywords" is a list of words that you want to use as links, you can put several separated by a comma, for instance "cat, kitten, cat training, cats" and then you have "Glossify Override" which is the url the words will link to, so for external urls they should start with http://

So that's it for the quick explanation. I know it isn't clear at all but every information is there, if I could have read this text when I first installed it, I wouldn't have spent time trying to understand how it works.

Now, if you want more detailled information, I can give you the different settings you should use in glossify configuration, in order:

Content types to be filtered: select the content type or content types (use CTRL+click to select several) that will have the words linked to your urls.

Target content types: select the content type glossifylink, the one you created on purpose for glossify.

Style of glossary terms: choose links.

Switches: select the following options (this is my choice, you can work out what you want) and deselect the others.. "Only link first occurance of term. On by default. If unchecked all occurences are replaced." - "Unicode compatibility." - "Check this to NOT break words." - "Case insensitivity." - "Link content in teaser"

Methods: here you have to select only Internal "Attach 2 additional fields to the selected Node types." and deselect "Make use of the title field of a node."

That's it really, with all those options it works fine for what I want to do, but of course Glossify can do much better, like interlinking nodes and taxonomy terms, many things indeed, but that's not the goal of this tutorial..

Now, I will explain in more details 3 things:

- Create a new content type: simply go to /admin/content/types/add and put the name glossifylink, no need for comment support or anything, since the nodes of this type will be created by yourself and are not meant to be shown anywhere on the site.

- Add the glossify filter to your input formats: go to /admin/settings/filters you'll see by default Filtered HTML and Full HTML, perhaps other filters you have created. For instance for Filtered HTML you click on "configure" which should lead you to the url /admin/settings/filters/1 and there you simply have to select the option "Glossify filter", in fact you have to check the check box Glossify filter under the "Filters" category. Save it and you're done.

- When you want to make a new link to somewhere, first create a new node of the type glossifylink, in title field you can write something that will help you remember at a glance what is this link about. Same for the body field, you can put some information or let it empty, it is not meant to be seen by anyone other than yourself. What is important are the two fields that have been added by Glossify (because you selected the method internal and checked that "Attach 2 additional fields to the selected Node types." option, after choosing your content type glossifylink in "Target content types") and the one where you want to paste your link is "Glossify Override", the path can be an external url starting with http:// or an internal url such as node/123 or an alias like "whatever-name-i-made-for-this-node".. So finally you have the field "Glossify Keywords" which will have the words you want to link to your url.. You can have several, keywords or keyphrases, but separated by a comma.

Here you go, this is the complete explanation, now if you are still wondering some things or have problem you can leave a comment, but the answer won't come very quickly.. That's why when I was searching how to do it myself, I couldn't find tutorials about it and the documentation doesn't help at all, it is not talking especially about what I wanted to do, but it is too general.. And so I didn't ask a question on any forum or anywhere because I wanted an answer / explanation quickly in less than a day, so I tried and thought about it which in the end took less time than waiting for an answer.. :-)

Please note that there is a bug (if there was only one that would be nice) in the version of glossify I'm using the 6x 3.0 beta 11.. The bug is that the 2 additional fields of glossify were added:
1. for all content types
2. for all users

First we want only he additional fields in the content types we have decided to use as glossify nodes. And second even if for some reason the glossify nodes are editable by other members we don't want them to be able to see or edit those fields if they don't have the roles we have set in the permissions for glossify..

So here is my report of this bug and also a temporary solution I have found by editing the module:
http://drupal.org/node/1714154
I simply added a condition so that the two fields will show only on the content type that I have created to store my external links and the keywords associated. I didn't deal with user permission in this "patch"/"solution" because my members can't edit this content type anyway.

Shestopalova
a visitor's picture

It's definitely a bit above my head and I don't fully understand why and how this would be used. I sort of understand the need to be able to go to any URL and control what's displayed there, but find WordPress' method of URL structuring pretty sufficient for all my needs so far. You have pages, posts, CPT's, etc. and nice URL's are generated for each. Within the standard template files or via hooks, the content on any page can be manipulated to display what and how you want to display it. Can you provide some more examples of where and how this would be used? I'm always excited by WordPress plugins to make my and my clients lives easier and better but I don't have that oh my god I've been waiting for this forever and this is a must use plugin reaction yet Maybe you can persuade me? Why should I use this plugin or why do I need it? Good work though and congratulations on this accomplishment!

Hello, this is not a Wordpress plugin and it has nothing to do with url rewriting. It is for linking automatically the words in your content on a Drupal site.

makeonlineshop
a visitor's picture

Are you still happy with this module ?

Thanks.

It is still active on this site. It is working most of the time.
There is an ongoing issue on the D6 version where sometimes Glossify wouldn't create the links on text content, but I don't know why and what happens, what is different when Glossify doesn't work.
It can work on a page, then next time not work on the same page, from one page display to the next, strange.
Link to the issue : https://drupal.org/node/1710006

Your feedback is important to us! We invite all our readers to share with us their views and comments about this page.

The content of this field is kept private and will not be shown publicly.
Please answer the question, even if it looks like a very stupid question, it filters out most of the spam.
Valentus