2

In a view, I have several fields that I would like to link to the original content. The title field's default behaviour is like this, but I want to have the trimmed body and the image fields to behave the same way too.

For this, using the content:path field and then rewriting the other fields using this one as a token has been recommended here. But this gives me the Drupal path, not the URL alias.

Another idea is to use Global Redirect module and to set it to always use URL aliases. But this obviously requires to install yet antoher module. I am hoping to manage without it.

The content pages behave according to the URLs so I need to have the aliased ones.

Is there a way to get the URL aliases in views link fields?

(I am using Drupal 7.23, Views 7.x-3.7 and Pathauto 7.x-1.2)

2

I do not see any problem here. You can do it like this:

  1. Add the view
  2. Add the fields
  3. Add NID, exclude it from display, and move it to top of list
  4. Open the field setting which you want to change, expand the Rewrite results fieldset, and check "Output this field as link"
  5. As link path input, enter node/[nid] (this is the token)
  • Yes! I knew it could not be very hard but somehow I could not make it work. Thank you. – turzifer Sep 16 '13 at 8:03

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.