Подключаем Wordpress к GatsbyJS
Установить плагины предварительно в Wordpress
WPGraphQL
This plugin turns your WordPress instance into a GraphQL server.
WPGatsby
This plugin modifies the WPGraphQL schema in Gatsby-specific ways and also keeps a record of when user actions happened. This allows us to do selective cache invalidation in Gatsby (to speed up builds) and add Preview support.
Install the
gatsby-source-wordpress-experimentalplugin.
Configuring the plugin
Create gatsby-node.js
Add code to gatsby-node.js
It queries your local WordPress GraphQL schema for all Posts, iterates through each Post node and constructs a static page for each, based on the defined template.
Last updated
Was this helpful?