By turzifer


2013-09-14 12:44:02 8 Comments

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)

1 comments

@xurshid29 2013-09-14 13:13:14

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)

@turzifer 2013-09-16 08:03:58

Yes! I knew it could not be very hard but somehow I could not make it work. Thank you.

Related Questions

Sponsored Content

3 Answered Questions

[SOLVED] Multiple path alias for a url

  • 2015-09-29 05:22:21
  • Guru
  • 1555 View
  • 3 Score
  • 3 Answer
  • Tags:   7 path-aliases

2 Answered Questions

[SOLVED] Path field gives wrong url

3 Answered Questions

[SOLVED] Menu doesn't link to alias URL

2 Answered Questions

[SOLVED] How to rewrite link to taxonomy term in Views when using Pathauto?

1 Answered Questions

[SOLVED] Url aliases/global redirect not being used in Custom Blocks

Sponsored Content