4

I'm looking for a valid replacement pattern, to get the url of the current node for a custom text in a list of filtered nodes.

Example markup for custom text field:

<a data-custom-attribute="john-doe" rel="123456789" href="[node:url]">[title]</a>

Unfortunately, Drupal doesn't show me any useful pattern examples:

Screenshot of replacement patterns interface

1 Answer 1

12

I think what you want to do is add "Content: Path" as a field. This is the path to the node.

  1. Make sure the "Exclude from display" box is checked.

  2. After you have added the field, make sure it is above your custom text field (click the arrow next to "Add" and select "Rearrange").

  3. Once, you've done that, [path] will become a replacement token.

7
  • 1
    Also of note, if you want an absolute path there's an option under Rewrite results to Use absolute link
    – Chapabu
    Aug 22, 2013 at 12:43
  • In order to be able to use a properties of node-field of a node in the custom text for a view-field, the properties or node-field must be added as view-field before the customized one (exclude it from display to avoid displaying it twice). Aug 22, 2013 at 13:01
  • 1
    @PierreBuyle, thats exactly what I said :) Aug 22, 2013 at 13:04
  • @ScottJoudry Indeed, that's why it is a comment. I re-phrased it as a generic solution, while you explained the steps needed to achieve the wanted result. Aug 22, 2013 at 13:48
  • 1
    Note: Make sure the Content: Path field is above the field you are trying to use to replace. Replacement tokens for each field are the fields above it in the view, not all the fields available.
    – Steven
    Sep 11, 2013 at 16:19

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.