Gatsby: [gatsby-source-wordpress] Option to "include" routes, rather than only exclude routes

Created on 7 May 2018  Â·  8Comments  Â·  Source: gatsbyjs/gatsby

Description

Feature request: WordPress plugins often throw a lot of extra junk into the WordPress json-api, it would be helpful to have the ability to define included routes (which would exclude ALL routes except the ones that match the condition). Currently gatsby-source-wordpress only has the ability to exclude routes. Something like the below would be very helpful! thanks!

includedRoutes: ["/*/*/posts", "/*/*/pages", "/*/*/media"],
Hacktoberfest good first issue help wanted

Most helpful comment

This is a really interesting idea — it might even make sense to make this as a default. I fairly regularly hear about someone trying Gatsby + WP than getting annoyed at it taking many minutes to sync everything from WP. It's a really bad first impression. It'd be better to only expose a subset of info that covers ~80% of use cases and then let people add more routes as needed.

To do this we'd need a way to make it really easy though to figure out what new routes need added as I can see people getting confused about that as well — UX tradeoffs! :-)

All 8 comments

If You (or anyone else) would like to take a stab at this - here's where wordpress plugin filters endpoints before doing requests - https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/src/fetch.js#L401-L456

This is a really interesting idea — it might even make sense to make this as a default. I fairly regularly hear about someone trying Gatsby + WP than getting annoyed at it taking many minutes to sync everything from WP. It's a really bad first impression. It'd be better to only expose a subset of info that covers ~80% of use cases and then let people add more routes as needed.

To do this we'd need a way to make it really easy though to figure out what new routes need added as I can see people getting confused about that as well — UX tradeoffs! :-)

I'll add my vote for this feature, unfortunately my coding skills currently aren't good enough to help implement this

Yes please!
When pulling data from big WordPress projects it can take a really long time to get it up and running, and it's beyond counter intuitive to go through all possible routes and exclude them, when I just want to pull posts, for example.

I might take a stab at implementing this.

@dmackerman check https://github.com/gatsbyjs/gatsby/pull/6036 - @lightstrike already started doing some work on this

@pieh Shouldn't this be closed since #6036 was merged?

@openmedi You are right! Thanks for ping

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oppenheimer1 picture Oppenheimer1  Â·  3Comments

dustinhorton picture dustinhorton  Â·  3Comments

kalinchernev picture kalinchernev  Â·  3Comments

jimfilippou picture jimfilippou  Â·  3Comments

ferMartz picture ferMartz  Â·  3Comments