Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix filtering taxonomy terms by collection #3870

Merged
merged 2 commits into from
Jun 17, 2021

Conversation

jasonvarga
Copy link
Member

@jasonvarga jasonvarga commented Jun 17, 2021

Fixes #1993
Fixes #1684

Whether you use the taxonomy tag like this:

{{ taxonomy:tags collection="blog" }} ... {{ /taxonomy:tags }}

Or through the query builder like this (which is basically what the tag is doing):

Term::query()->where('taxonomy', 'tags')->where('collection', 'blog')->get()

It's supposed to filter down the terms to ones being used within that collection. It doesn't.

Looks like a refactor a while ago removed this and it never made it back in.

This PR brings it back, and adds some general term querying tests.

@jasonvarga jasonvarga merged commit e70f518 into 3.1 Jun 17, 2021
@jasonvarga jasonvarga deleted the fix/1993-taxonomies-by-collection branch June 17, 2021 21:54
@michaelmannucci
Copy link

Has this been resolved?

@edalzell
Copy link
Contributor

Yes, it has been merged

@michaelmannucci
Copy link

I'm asking because it still doesn't work for me. {{ taxonomy:tags collection="blog" }} {{ title }} {{ /taxonomy:tags }} just returns the title of the page, not an tags from the collection.

@jasonvarga
Copy link
Member Author

Seems to still work.

If you're seeing the title of the page, that'd be because you have no results.

@michaelmannucci
Copy link

I have at least one result for sure.

Here's my antlers:

{{ taxonomy:scripture collection="sermons" }}
    <li>{{ title }}</li>
{{ /taxonomy:scripture }}

Here is the taxonomy that's for sure in one of my collection entries:

title: Luke
testament: NT
sequence: '42'

And here is the entry with the taxonomy. See "scripture":

---
id: aa6afbdf-04f0-4619-8103-d9f12af46af9
blueprint: sermons
title: 'Zechariah''s Perspective'
spanish_title: 'El Nacimiento de Cristo: desde los ojos de Zacarías'
speaker: 59facb7f-331e-411c-ace4-1fff53053be7
sermon_series: 48597335-b6d6-4e71-9bd4-e3e953c7b5c9
scripture: luke
chapter_verse: '1:5-25,57-80'
description:
  -
    type: paragraph
    content:
      -
        type: text
        text: 'As a priest in the temple; the father of John the Baptist; the husband of Elizabeth, a relative of Mary; and, like Mary, also a recipient of a visit by the angel Gabriel; Zechariah was given a very unique perspective on the coming of the Messiah.'
sermon_date: '2019-12-01'
service: Morning
audio: 2019/12/20191201_CHPR01_ZechariahsPerspective_DavidRobinson.mp3
spanish_audio: 2019/12/20191201_CHPR01_ZechariahsPerspective_DavidRobinson_Spanish.mp3
video: 'https://vimeo.com/376657063'
updated_by: c6611ac7-c23a-4bc4-885f-fed9169829c6
updated_at: 1637772490
---

Any idea what I am doing wrong?

@jasonvarga
Copy link
Member Author

Does the sermons.yaml collection have taxonomies in it?

@michaelmannucci
Copy link

Looks like that was the issue...

Strange though. I added the "Taxonomy Terms" fieldset to the blueprint for sermons... should that be automatic?

@jasonvarga
Copy link
Member Author

It'll automatically add the field to the blueprint if you enable taxonomies on the collection.
Not the other way around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants