14

In a fields view, the "title" field has a check box "Link this field to the original piece of content". But this check box isn't available for other fields. How can I achieve this functionality for other fields?

E.g. in my case I have a custom "subtitle" field, and I would like to list the nodes subtitles. The subtitles should be links that point to the node.

0
25

as @Daphna mentioned and you can see here: drupal.org/node/1234862 you can use Content: Path field value as a token for the field you want to be linked to the content:

  1. add Content: Path field and in the configure field modal box check Exclude from display to hide this field from being displayed and rearrange fields so this field is above the field you want to be linked to the content.
  2. click the field you want to be linked to the content to open configure field modal box and in the Rewrite results section check Rewrite the output of this field.
  3. in the opened textarea under Rewrite results write this: <a href="[path]">[field_name]</a>. you should replace field name with proper token of the field you want to be linked. you can find all the fields token in the Replacement patterns section under Rewrite results.
5
  • 3
    The field you have to add is "Content: Path" to be able to use [path], not "Content: Link". – user18699 Jun 25 '13 at 18:56
  • 1
    tnx @Zeroth, I edited my answer. – sepehr Jun 26 '13 at 8:39
  • @Zeroth Thank you very very very muccchhhh!!!!!!!! :) – Winston Sep 5 '13 at 15:11
  • I spent some time wondering why I can't see Content: Path in rewrite patterns, who would have thought I need to rearrange the fields. WTF. It was hard to google for this answer, thanks. – headsvk Aug 24 '15 at 19:33
  • also don't forget to uncheck "link image to its content" on 2nd field if you are doing this option, because then you would have 2xAnchor links. – Michael Mar 9 '16 at 16:28
6

What the subtitle field to know is, where to link it. This is done with the NodeID field (nid).

  1. add the "Content: Nid (The node ID)" field; Select the hide it from Display option
  2. Rearrange that field. Push it higher than your subtitle (so it can grab that nid)
  3. rewrite the output as a link with the nid, like node/[nid] or something
  4. Voilà

Adding the hidden Nid field makes the token [nid] available in the subtitle field when making it a link. Also you need to have Token installed.

Or http://drupal.org/node/1234862 maybe?

2
  • 1
    Here drupal.org/node/1234862 they suggest using content:path, which I think is better. Could you edit this into your answer? – daphshez Sep 29 '11 at 7:12
  • This doesn't support the path module (as @Daphna has pointed out). – Adam Balsam Jun 25 '13 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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