I have an entity type consisting of 2 fields, a description field and a URL field, and I want to create a view with a single column which consisting of the description outputted as a link to the URL, ie <a href="url">Description</a>.

I don't know whether I am doing it the right way. I tried to use the tokens and rewrite results to create URL in the form <a href="url">Description</a> but it winds up pointing to the Drupal node. Is there some way of creating some kind of calculated field pointing to the URLs?

  • 1
    How is the link module different drupal.org/project/link. It gives you the option for a title field and a link field. Give it a try if you are basically trying this <a href="[URL]">[Title]</a>
    – junedkazi
    Sep 23, 2012 at 1:59
  • @junedkazi The question was about how to do it in a view which I didn't mention in the title, however your tip is appreciated.
    – vfclists
    Sep 23, 2012 at 2:14
  • so the link module has full view support as well. Did you give it a try ??
    – junedkazi
    Sep 23, 2012 at 2:55

1 Answer 1


In Views you have a couple of ways to do this:

Method 1:

  1. Add the url field to the view, but "exclude" it from the display

  2. Add the description field to the view, but re-write its out put to a link and add the URL token replacement as the URL or path.

Method 2:

  1. Add the url field to the view, but "exclude" it from the display

  2. Add the description field to the view, but "exclude" it from the display

  3. Add a global field for custom text and inside of it add field-description where field-url and field-description are the replacement token from the fields added to the view.

Note: In views it is important the order of the fields, so if using method 1 the url field has to be placed before the description field.

  • I have been working along these line, but I think I have got the tokens and where to place them mixed up.
    – vfclists
    Sep 22, 2012 at 23:50
  • BTW just a note the replacement tokens the views can use, might not necessary be tokens available on the site for other content type or entities. The replacement token in views are generated from the fields added to the view.
    – Emil Orol
    Sep 22, 2012 at 23:54
  • I have it working now. The description field was mostly a duplicate of the Title which I planned to flesh out later, so I was using the Title initially, but it has a default option which sets it as a link to the original record which seemingly cannot be overriden. Once I unticked it it worked normally, so I was on the right track after all. Thanks
    – vfclists
    Sep 23, 2012 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.