Skip to content

Is it possible to prepare static queries, dynamically (at build time)? #29120

Discussion options

You must be logged in to vote

Ok it seems gatsby-node.js is the right direction. I can use the sourceNodes function to create my own node type that will serve all my possible data, statically. In that I could query my GraphQL API like described in the createPages function.

I also figured out that I could simply request categories and get their 20 newest posts in one step using one static query, I don't need to do this in node at all, but it gave me a good idea that this is possible. In my case I am a little bit screwed, because the category type is not from Wordpress, but from a plugin, so I have to expose this to the WP GraphQL API, but this is another story and has nothing to do with this discussion.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by martin-braun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant