-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow Gatsby Source Kontent Plugin to filter by collection #191
Comments
Curious if adding support for query params would be a good way to approach this. On our sites we would benefit from filtering content items by workflow steps (such as One wrinkle to this approach is that it appears filtering by language is handled with a query param, so perhaps it would need to be documented as an optional |
Hello @anthonyshughes and @bwlng, thank you for reaching out! I was thinking about the robustness of the solution. And @bwlng's idea about extending the configuration is pretty easy to implement but the robustness would not be really great - I will try to come up with something more complex, like a hook, but we can fall back to the easy string-based configuration for the queries. - Can you think of any other filter you might want to use? IMO it makes sense for filtering based on But in general, I have identified some possible problematic areas I would like to discuss prior to the implementation. Cross collection Links
Cross Links that aims to filtered-out item
Webhook handling
I also have one more general question. I am testing gatsby v4 compatibility (#192), which is currently in alpha. What do you think about upgrading to the gatsby v4 with your project - my preliminary testing looks like there might not be any breaking changes from the kontent gatsby source plugin point of view. |
Yes I agree that it would make sense to create a more generic solution to allow filtering on all the system properties rather than just collection. Cross collection Links Webhook handling I think that the potential issues that could be caused by implementing this feature could also be a problem for anyone using the Delivery Rest API. If these points are documented via the API filtering section then it shouldn't cause too many problems. Gatsby V4 |
Alright, how about trying the lean approach? I will implement the feature, release the feature in alpha as experimental, you will test it out and if everything is OK, I can include it as an experimental feature in the standard release (and add tests for it). After some adoption/testing time, we can continue to push it as standard configuration property in one of the upcoming major/minor releases. What do you think? |
We are happy to go with this approach and test it out. |
We have upgraded to V4 (4.0.0-alpha-9689ff.5) and it hasn't caused any noticable issues. Seems to have sped up page queries which is nice. |
Great to hear! I still need to release the kontent gatsby source plugin to ensure that the source plugin is correctly using Gatsby v4. Out of interest: Could you share the numbers for the time boost? |
I have released version I have described options in the Available options section - so for you, the value could be |
This is only from a local single clean (no cache) build for each version so not exactly scientific but a definite improvement. |
We have tested this using a single collection as the filter and also mutliple (system.collection[in]=austria,default) and it works perfectly. Not only has it reduced the time to source and transform nodes but it has also reduced the time to run the page queries. I assume because the page queries now have less nodes to sort through. |
Perfect @anthonyshughes! I will keep this version out like that for a while so that you can send your feedback if you have some. |
@Simply007 I tested
Works as expected, thanks so much! I can't think of any filters outside of the system properties we would need to filter.
|
Thank you both for the feedback @bwlng @anthonyshughes! May I ask you for one more favor? Could you change the collection/workflow step to the one that is filtered in and vice versa? I was wondering how does it behaves if you have the update webhook configured time-vise as well as for behavior itself. I guess it should remove/add item, but better to double-check. |
Hey @bwlng and @anthonyshughes, I have released v8.0.0-beta.0 with gatsby v4 support + filtering model feature:
Feel free to test it - feedback is welcome! |
Version 8.0.0-beta.1 of packages:
Contains only deprecation fixes - functionality should not be affected. |
@Simply007, |
@Simply007 Thanks! I have been using the filtering option in v8 and have no issues to report with this feature. Works great 👍 |
I am closing the issue. Feature is released in https://github.com/Kentico/kontent-gatsby-packages/releases/tag/8.0.0 |
Motivation
We use one Kontent project with multiple collections for mutiple sites. We have a separate build process for each site. This means that each site pulls all the data down for all the sites even though it is not needed. We can filter by language but all our sites use the en-gb language as well as their own native language so all en-gb content is pulled even if it is not in a relevant collection
Proposed solution
Enable filtering on collection as well as language
The text was updated successfully, but these errors were encountered: