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

Get helper +/- tag #9574

Closed
JohnONolan opened this issue Apr 16, 2018 · 4 comments
Closed

Get helper +/- tag #9574

JohnONolan opened this issue Apr 16, 2018 · 4 comments
Assignees

Comments

@JohnONolan
Copy link
Member

JohnONolan commented Apr 16, 2018

<section class="site-section">
{{#get "posts" filter="tag:highlight" limit="3"}}
  {{#foreach posts}}
    //post
  {{/foreach}}
{{/get}}
</section>

<section class="site-section">
{{#get "posts" filter="tag:news,-highlight" limit="3"}}
  {{#foreach posts}}
    //post
  {{/foreach}}
{{/get}}
</section>

In this use case, I'm trying to build a page which does the following:

  • Section 1: Highlights -- Get 3 posts tagged with "highlight"
  • Section 2: Tag Feed -- Get 3 posts from a particular tag
  • Section 3: Tag Feed -- Get 3 posts from a particular tag
  • Section 4: Tag Feed -- Get 3 posts from a particular tag

I want section 1 to always show any posts tagged with highlight, and I want all other sections to exclude any post tagged with highlight. That way, my page will never have any repeating posts. If a post appears in section 1, it won't appear in sections 2-4.

Currently, the above code doesn't work. I've been through all the docs here https://themes.ghost.org/docs/get and here http://api.ghost.org/docs/filter - and I'm pretty sure it should work.

tag:-thing works, but any combination of more than one thing which contains an exclude breaks the get helper. Eg. tag:-thing,-otherthing or tag:-thing,otherthing

I also tried other syntax based on the API docs, eg. tag:new-things+tag:-highlight but that didn't work either.

Almost all of these do work UNLESS a single post contains both properties (a tag to include and a tag to exclude) in which case, the post is included. If anything, it should probably be the other way around? Exclusion should probably always take precedence over inclusion.

Or another way to look at it might be depending on what order things are passed in. Eg. The first rule always takes precedence

Anyway, pretty sure this is a BUG! 🌮?

@kirrg001
Copy link
Contributor

Yeah this is a bug.

Duplicate of #6158.

GQL has tracked this here. I've added this to the project board. Priority will be discussed.

Closing.

@kirrg001
Copy link
Contributor

kirrg001 commented Apr 17, 2018

Priority is low, but we try to work on this in the new future. If you are interested, you can subscribe to TryGhost/GQL#16.

kirrg001 added a commit that referenced this issue Dec 11, 2018
refs #10105, closes #10108, closes #9950, refs #9923, refs #9916, refs #9574, refs #6345, refs #6309, refs #6158, refs TryGhost/GQL#16

- removed GQL dependency
- replaced GQL with our brand new NQL implementation
- fixed all known filter limitations
- GQL suffered from some underlying filter bugs, which NQL tried to fix
- the bugs were mostly in how we query the database for relation filtering
- the underlying problem was caused by a too simple implementation of querying the relations
- mongo-knex has implemented a more robust and complex filtering mechanism for relations
- replaced logic in our bookshelf filter plugin
- we pass the custom, default and override filters from Ghost to NQL, which then are getting parsed and merged into a mongo JSON object. The mongo JSON is getting attached by mongo-knex.

NQL: https://github.com/NexesJS/NQL
mongo-knex: https://github.com/NexesJS/mongo-knex
@kirrg001
Copy link
Contributor

This bug was fixed in Ghost 2.8.0.

@JohnONolan
Copy link
Member Author

Awesome - now I can fix blog.ghost.org ❤️😬

daniellockyer pushed a commit to TryGhost/framework that referenced this issue Jun 15, 2021
refs #10105, closes #10108, closes TryGhost/Ghost#9950, refs TryGhost/Ghost#9923, refs TryGhost/Ghost#9916, refs TryGhost/Ghost#9574, refs TryGhost/Ghost#6345, refs TryGhost/Ghost#6309, refs TryGhost/Ghost#6158, refs TryGhost/GQL#16

- removed GQL dependency
- replaced GQL with our brand new NQL implementation
- fixed all known filter limitations
- GQL suffered from some underlying filter bugs, which NQL tried to fix
- the bugs were mostly in how we query the database for relation filtering
- the underlying problem was caused by a too simple implementation of querying the relations
- mongo-knex has implemented a more robust and complex filtering mechanism for relations
- replaced logic in our bookshelf filter plugin
- we pass the custom, default and override filters from Ghost to NQL, which then are getting parsed and merged into a mongo JSON object. The mongo JSON is getting attached by mongo-knex.

NQL: https://github.com/NexesJS/NQL
mongo-knex: https://github.com/NexesJS/mongo-knex
daniellockyer pushed a commit to TryGhost/framework that referenced this issue Jun 15, 2021
refs #10105, closes #10108, closes TryGhost/Ghost#9950, refs TryGhost/Ghost#9923, refs TryGhost/Ghost#9916, refs TryGhost/Ghost#9574, refs TryGhost/Ghost#6345, refs TryGhost/Ghost#6309, refs TryGhost/Ghost#6158, refs TryGhost/GQL#16

- removed GQL dependency
- replaced GQL with our brand new NQL implementation
- fixed all known filter limitations
- GQL suffered from some underlying filter bugs, which NQL tried to fix
- the bugs were mostly in how we query the database for relation filtering
- the underlying problem was caused by a too simple implementation of querying the relations
- mongo-knex has implemented a more robust and complex filtering mechanism for relations
- replaced logic in our bookshelf filter plugin
- we pass the custom, default and override filters from Ghost to NQL, which then are getting parsed and merged into a mongo JSON object. The mongo JSON is getting attached by mongo-knex.

NQL: https://github.com/NexesJS/NQL
mongo-knex: https://github.com/NexesJS/mongo-knex
daniellockyer pushed a commit to TryGhost/framework that referenced this issue Jun 15, 2021
refs #10105, closes #10108, closes TryGhost/Ghost#9950, refs TryGhost/Ghost#9923, refs TryGhost/Ghost#9916, refs TryGhost/Ghost#9574, refs TryGhost/Ghost#6345, refs TryGhost/Ghost#6309, refs TryGhost/Ghost#6158, refs TryGhost/GQL#16

- removed GQL dependency
- replaced GQL with our brand new NQL implementation
- fixed all known filter limitations
- GQL suffered from some underlying filter bugs, which NQL tried to fix
- the bugs were mostly in how we query the database for relation filtering
- the underlying problem was caused by a too simple implementation of querying the relations
- mongo-knex has implemented a more robust and complex filtering mechanism for relations
- replaced logic in our bookshelf filter plugin
- we pass the custom, default and override filters from Ghost to NQL, which then are getting parsed and merged into a mongo JSON object. The mongo JSON is getting attached by mongo-knex.

NQL: https://github.com/NexesJS/NQL
mongo-knex: https://github.com/NexesJS/mongo-knex
daniellockyer pushed a commit to TryGhost/framework that referenced this issue Jun 15, 2021
refs #10105, closes #10108, closes TryGhost/Ghost#9950, refs TryGhost/Ghost#9923, refs TryGhost/Ghost#9916, refs TryGhost/Ghost#9574, refs TryGhost/Ghost#6345, refs TryGhost/Ghost#6309, refs TryGhost/Ghost#6158, refs TryGhost/GQL#16

- removed GQL dependency
- replaced GQL with our brand new NQL implementation
- fixed all known filter limitations
- GQL suffered from some underlying filter bugs, which NQL tried to fix
- the bugs were mostly in how we query the database for relation filtering
- the underlying problem was caused by a too simple implementation of querying the relations
- mongo-knex has implemented a more robust and complex filtering mechanism for relations
- replaced logic in our bookshelf filter plugin
- we pass the custom, default and override filters from Ghost to NQL, which then are getting parsed and merged into a mongo JSON object. The mongo JSON is getting attached by mongo-knex.

NQL: https://github.com/NexesJS/NQL
mongo-knex: https://github.com/NexesJS/mongo-knex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants