Drupal - Making 2 Links from a View Field

In a Drupal view, one of the presentation options for a selected field is to have the field be a link to its node. What if you need the label to also be a link? No problem! Another option is to rewrite the output, so you can manually create the links using HTML, and specify the replacement pattern of [nid] for one. The only problem is that when a field is a link to its node, the URL that appears is the path alias, mydomain.com/my-content, but when using [nid] in a manually constructed link, the resulting URL is mydomain.com/node/##.

Of course, you cannot simply embed HTML in the label. With that in mind, here are the steps:

  1. Remove the field label
  2. Check the Exclude from display box
  3. Add a global text field:
<a href="mylink1">Link Text</a>[replacement_tag_of_original_field]

Add new comment

Markdown

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Missing filter. All text is removed
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.