3

I am using a taxonomy together with the Lexicon module to automatically create links to another website (a pretty neat solution with instructions here)

But I would also need to create view that list all nodes that contain the taxonomy terms. I am fairly competent at using the views module but I cannot figure out how to take the list of taxonomy terms and display all nodes that contain the terms in the text and what taxonomy terms the node contain.

2 Answers 2

6

If I understand correctly, you want to have one page that will display nodes grouped by taxonomy term they belong to so that the result is like this:

  • Term 1

    • article 1
    • article 2
  • Term 2

    • article 2
    • article 3
  • Term 3

    • article 1
    • article 3

To achieve that:

  1. Create a view to display all content of [content type name] and select the node fields you want to display in place of article 1,2,3 (probably title of the node at least).
  2. Add relationship "Content: Taxonomy terms on node" and decide which taxonomy you want to narrow down the display.
  3. Under View field, there should be now a list of Taxonomy related fields. You probably want to add field "Taxonomy term: Name". Exclude that field from display.
  4. Under View format settings, select to Group By that taxonomy field.
2
  • Thank you. But I think two things prevent this from working. 1) The Taxonomy terms on node only provide access to the taxonomy field of the node. I need to pull taxonomy terms from the body field and compare it to a taxonomy list. 2) This does not filter out nodes which do not contain any taxonomy terms.
    – Sigvard
    Mar 9, 2015 at 9:39
  • Thank you @Kasia W . I was wondering if there would be the possibility to display the description with the term to have - Term 1 : Description -- Article a -- Article b - Term 2 : Description -- Article a -- Article c etc. Dec 4, 2018 at 11:42
1

If what you want is list all nodes that are referencing a taxonomy term, a way do to it is to:

  • Create a Content view
  • Add a contextual filter Content: Has taxonomy term ID (with depth)

This relationship also lets you display nodes that are not directly referencing the term, but referencing a term in the same tree: with the depth parameter.

You might need to add a Relationship of your term if you don't have access to the taxonomy term fields you want: Content: Taxonomy terms on node

Then to pass the term ID argument to the view, I usually use panels to override the taxonomy term page, but I believe you can directly do it with views, or a module like this one: Taxonomy Views Integrator.

1
  • My problem is that I need to compare the list of taxonomy terms with free text in the body field so the taxonomy ID won't work but I will look into the taxonomy views integrator to see if I can find anything.
    – Sigvard
    Mar 9, 2015 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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