New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Filter a page of taxonomies by their term

Grant Smith September 5, 2020 by Grant Smith

In v2 I used to be able to filter a page of taxonomies with their term using the following.

{{ collection:articles paginate="true" as="posts" limit="9" taxonomy="true" }}
  {{ posts scope="categories" }}
    {{ partial:articles/articles-listing-card-lg }}
  {{ /posts }}
  {{ partial:pagination }}
{{ /collection:articles }}

This resulted in a page listing all the articles categorised as news for example if /articles/categories/news is the slug.

Upon upgrading a v2 site to v3 this no longer works for me. Playing around resulted in me working out this is down to the taxonomy="true" part of the code. Removing it allows the site to load, however, the resulting page has no categories listed.

Leaving taxonomy="true" in results the following error…

Call to a member function collections() on null

After reading more times than I care to mention and experimenting loads, I'm stuck! loads, I'm stuck!

Answered by Mike Martin!
>>>>>>> Answered <<<<<<<
3 Replies