3

How do I change the text of a link in Views?

Under 'Fields' I have Content:Title (the default)...and that's what I want. It links to the piece of content with the link being the Title of that document. But I want to change the link text to something else.

I tried clicking that field. It opens up a dialog. Under 'Rewrite Results' I selected 'Override the output of this field with custom text' and put in my custom text. But now instead of it being a link it's just static text. That's useless.

Replacement patterns don't have any links listed just {{title}} and {{ title__value }} == Raw value

'Link to this content' is still checked at the top btw.

1 Answer 1

3

In Fields add Path and _Exclude from display. In your title, uncheckmark Link to the Content.

In rewrite results, checkmark Override the output of this field with custom text and put <a href="{{ path }}">Custom Text</a>. Alternatively, in rewrite results, checkmark Output this field as a custom link, for the path put {{ path }} and scroll down a bit to Title text and write your title here.

1
  • Unfortunately "Title text" only changes the title attribute of the a tag and not the link text.
    – 0711master
    Commented Feb 20, 2018 at 18:34

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.