Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[gatsby-source-wordpress] Improves README, “permalinks should not be set to Plain” #5053

Merged
merged 2 commits into from
Apr 20, 2018

Conversation

kennethormandy
Copy link
Contributor

Updates the documentation to explain the WordPress “Plain” permalinks issue in #1871, which I also encountered. It’s fixed by switching the permalink setting, as described #1871 (comment) here, and now in the docs.

A more comprehensive fix might be to support the query parameter URL style in the plugin too, like http://demo.wp-api.org/?rest_route=/ (found here WP-API/WP-API#1489 (comment)).

I think it’s worth supporting this in the plugin itself, because WordPress default seems to be Plain permalinks, so the WP JSON API is off if you are starting from a fresh install. Should the Plain url be a config option that is off by default?

Thanks for the ongoing hard work on Gatsby :)

@gatsbybot
Copy link
Collaborator

Deploy preview for using-drupal ready!

Built with commit 31c8505

https://deploy-preview-5053--using-drupal.netlify.com

@gatsbybot
Copy link
Collaborator

Deploy preview for gatsbygram ready!

Built with commit 31c8505

https://deploy-preview-5053--gatsbygram.netlify.com

Copy link
Contributor

@m-allanson m-allanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@m-allanson
Copy link
Contributor

It sounds like your proposed change would fix this issue for everyone? If so then it'd be good to add it to gatsby-source-wordpress.

@m-allanson m-allanson merged commit 260289a into gatsbyjs:master Apr 20, 2018
@pieh
Copy link
Contributor

pieh commented Apr 20, 2018

Adding support for no prettylinks might be a little bit tricky - for example for this option:

// Exclude specific routes using glob parameters
// See: https://github.com/isaacs/minimatch
// Example:  `["/*/*/comments", "/yoast/**"]` will exclude routes ending in `comments` and
// all routes that begin with `yoast` from fetch.
excludedRoutes: ["/*/*/comments", "/yoast/**"],

But I agree it would be nice to handle this.

@kennethormandy
Copy link
Contributor Author

It looks like it would be possible just to change from the default URL to the format that works with the Plain permalinks.

The case @pieh mentioned is a good observation but should be fine, since the URL structure is the same after the different prefix. I don’t know if there are other WordPress-specific reasons not to make this the default though—the WP documentation seems very committed to the /wp-json endpoint, and only mentions the ?rest_route= endpoint once.

@m-allanson I can open a PR to make this change if you want, but it would be good to have someone more specialised in the WordPress REST API take a look too.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants