Listing all values of taxonomies

I’m just trying to list all entries of a passed in taxonomy for a collection of pages. I have a collection of sermon pages and they have an author and book associated:

title: 'The Title of the Post'
taxonomy:
    category: 'sermon'
    author: 'Person A'
    book: [Matthew,Mark,Luke]

and

title: 'Another Title of a Post'
taxonomy:
    category: 'sermon'
    author: 'Person B'
    book: [Mark,Luke,John]

What I want to see is the following:

List of Authors:

  • Person A
  • Person B

List of Books

  • Matthew
  • Mark
  • Luke
  • John

How do I output this list? And where can I learn more about the properties of the taxonomy object besides examples that list tags of a given page/item? Thanks.

I remember having some trouble finding this one not long ago! It’s just not a very intuitive or documented method name. The Twig I used is:

taxonomy.getTaxonomyItemKeys('category')

so substitute ‘category’ for ‘book’ or whatever.

I figured this out by studying the API docs and code but it involved lots of experimenting too, since as I mentioned it’s not well covered. I think there’s a way to extract slices of individual vocabs from the taxonomy tree object too, from memory.

Oh outputting as a list would be a matter of looping through the resulting array BTW. Not sure if you need help at that level.

1 Like

This is SUPER HELPFUL, thank you!

This method produces a collection that I can now filter and sort. I also was able to do a count of the matched entries like so using findTaxonomy():

taxonomy.findTaxonomy({'book':[PASSED IN TAG VALUE]})

Thanks again!