I have view which it has content type filter with more than 1 content type(Eg: A,B). For one specific content type(B) i want to alter the title link to external url(This external url is a custom field in that content type(B) ).

If I alter through Rewrite results using token(custom url),it work fine for the title which comes from B content type, but the title which comes from A content type is going to home page since this custom field is not available in that content type(A).

Please some one suggest on this.

1 Answer 1


You can do it via views itself with the little tweaking.

Since you said the custom URL will not be available in other content types,

  • Add the required fields including custom field and the content path to your views fields. Fields added to view including default Path and Custom third-party link field

  • Open the custom URL field and go to No Results Behaviour. Add the Replacement pattern of default content path. No result behaviour added to Third-party link field.

  • Created a custom text and assembled results. Make sure u refer to custom URL field to link and not the default content URL. In My case, I referred third party reference field added to link

It should automatically work now. Whenever there is no third party URL link not available, it will fetch the default URL. This should have your issue resolved.

But in case if the third-party URL field was available in all content type with some data, Then you need to do this in preprocess function. This approach will have issues.


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.