-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-source-wordpress): Add "path" field to post/page/custom post type entities #11775
feat(gatsby-source-wordpress): Add "path" field to post/page/custom post type entities #11775
Conversation
|
||
exports.createUrlPathsFromLinks = entities => | ||
entities.map(e => { | ||
if (e.__type === `wordpress__PAGE` || e.__type === `wordpress__POST`) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't handle custom post types. I wonder if we instead could check:
if (e.link && !e.path)
to check if link is on entity and just sanity check to not override path field if it already exists (someone or some plugin enriching REST endpoint on wordpress side)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback. Also the sanity check makes totally sense.
I was conservative regarding the types, as the current Wordpress project I use for testing only has normal pages and posts.
But I should have a deeper look into the example data stemming from the official Gatsby demo wordpress site.
I’ll try it tomorrow :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pieh, I added your suggestion.
@riddla Could you please fix the linting issue? Looks great otherwise! |
@sidharthachatterjee, we should be good now regarding ESLint. |
@pieh, @sidharthachatterjee, we should be good here? |
b082cdb
to
2cd77fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @riddla! 🎉
Description
Picked up from the documentation change over at #11126, this makes a
path
field available within the WordPress entities.Usage example
Related Issues
Related to #11126