0

I have created a RESTful view in Drupal 8, there I need to display a few of node contents by node alias in contextual filter.

View URL: www.example.com/api/book-details/{node-alias}

Instead of node alias if I use node ID, it's working fine. For example: api/book-details/100 (node ID 100) is working fine.

URL alias for node 100 is "first-content". So how do I fetch details using node alias in contextual filter? For example: api/book-details/first-content (this is not giving any result).

0

As No Sssweat already mentioned in his comment there is no Contextual filter available for path aliases, you can try to create your own (and share on drupal.org while you're at it :) ).

But if you have set your aliases based on node Titles then you may get away with using Content: Title as your contextual filter.

Just be careful about the Case in Path setting and you'll probably need Transform spaces to dashes in URL under More.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.