1

I'm trying to create view which will show all Articles which tag is equal to title of currently being viewed node (which content type is not Article).

Adding filter Has taxonomy term = [title] does not see token. My question is how to pass current page title to filter or this is done with contextual filters?

For example, I have the Author content type. On Author nodes, I want to add a view which shows the last three articles which have tags equal to the title of the node. (In my case, it's the author's name.)

Author is not a type of user, nor a role assigned to users.

I managed to get something (but not good enough to work):

  • View: Unformatted list of fields
  • Filter criteria: Content type (=Article)
  • Contextual filter: Content:Tags
  • Provide default value: Taxonomy term ID from URL
  • Validator: Taxonomy term (Tags) + Transform dashes in URL to spaces in term name filter values

When I try to preview the results (Preview with contextual filters), with "chuck-norris" it returns the result as expected, but it doesn't work with "author/chuck-norris", so it doesn't show result on page for Chuck Norris. I also tried with different options (e.g. default value Rawvalue from URL, path component 2, with checked Use path alias).

2
  • Can you please re-frame your question. It is not so clear. Do you want make views with articles, but how you want to display? Like title, body(teaser), tags Or whole article. please provide step-wise details if possible.
    – CodeNext
    Commented Jul 19, 2016 at 12:32
  • View should display list of Articles (fields title and image), but I don't know why does display matters. View will be part of Panel for display of single Author. So, page for Author Chuck Norris should display info of Chuck, and last three articles which have tag "Chuck Norris".
    – jare25
    Commented Jul 19, 2016 at 12:45

1 Answer 1

1

I'm trying to create view which will show all Articles which tag is equal to title of currently being viewed node (which content type is not Article).

Instead of being equal to title, you can approach it like this.

Go to your Author content type, and in Manage fields, add a taxonomy term reference field. Select Tags.

Edit your Author Content Type and give it the same tag as the title.

In other words, you tag the Chuck Norris node with the Chuck Norris tag, which means now your Chuck Norris node as a term ID.

Then in your view

enter image description here

2
  • One more thing - is there some way to automatically fill Author tag to be equal as title? Rules module or something...? Edit: Maybe this drupal.org/project/computed_field
    – jare25
    Commented Jul 20, 2016 at 8:05
  • @jare25 Rules module should do the trick. If you need help with that ask a new question regarding that. Computed field will not work here, computed field is just to do math stuff. + - x /
    – No Sssweat
    Commented Jul 20, 2016 at 8:28

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.