GithubHelp home page GithubHelp logo

gatsbycentral / gatsby-starter-wordpress Goto Github PK

View Code? Open in Web Editor NEW
391.0 15.0 130.0 14.63 MB

LOOKING FOR MAINTAINER - - - A GatsbyJS starter template that leverages the WordPress API, ACF and more

License: MIT License

JavaScript 96.53% Sass 3.47%
gatsbyjs gatsby-starter gatsby wordpress

gatsby-starter-wordpress's Introduction

Gatsby v2 WordPress Starter

This starter is forked from the gatsby-starter-netlify-cms and modified to use WordPress instead of netlify-cms, using the gatsby-source-wordpress plugin as the data connector.

Demo: https://gatsby-starter-wordpress.netlify.com/

Looking for maintainer: If you're interested in taking over the maintenance of this starter, please reach out in an issue. We're not working with Gatsby any more (it got way too complicated, hello nextjs), and so we're not maintaining this.

Use It Now

gatsby new NAME https://github.com/GatsbyCentral/gatsby-starter-wordpress
  • Edit gatsby-config.js, change baseUrl
    • Make sure you have at least 1 post and 1 page on your WordPress site
    • Make sure at least 1 post has at least 1 tag
  • Ensure the permalink structure in your WordPress installation is set to Post Name instead of the deafult Plain, or else the gatsby-source-wordpress plugin won't be able to communicate with WordPress
  • Rejoice

Known Limitations

  • This is based on the netlify starter which uses bulma. This adds 150KB to every built page.
  • Your WordPress site must have at least 1 post with 1 tag, or the starter will crash
  • Nested pages / categories will not render with nested pages
    • A WordPress page like /about/team/ will render on Gatsby as /team/
    • Likewise for categories
    • Discussion here #24

CSS Processing

This plugin uses gatsby-plugin-purgecss and bulma. The bulma build would otherwise be ~170K which adds 170K to each of your built HTML pages. However, with purgecss this is reduced 90%.

WordPress Setup

Check the gatsby-source-wordpress plugin for more information. If you want to copy the demo content, you can grab the WordPress XML export here and import it into your WordPress site as a starting point.

Support

Please post support questions on StackOverflow or other similar sites. Please only post issues here if you have a bug to report with a reproduction. Unfortunately we're not able to provide support here.

Contributors

This starter was forked from the netlify starter by the GatsbyCentral crew. Additional contributions were gratefully received from the following folks:

gatsby-starter-wordpress's People

Contributors

anantoghosh avatar chmac avatar dajocarter avatar dependabot[bot] avatar jeffreznik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-starter-wordpress's Issues

Is this starter actively maintained?

Hey @ericwindmill, firstly, awesome starter. Great to get a jump start with WordPress.

Are you actively maintaining the starter? I noticed a few minor bugs, some broken links, stuff like that. It gave me the thought that maybe you're not actively using the starter. If that's the case, any interest in transferring it to us at @GatsbyCentral? We're actively doing stuff in the Gatsby space (writing posts, hosting a meetup here in Berlin, videos, etc). I'm also a long standing WordPress developer so I know both sides of the puzzle.

I'll whip up a PR or two with some of the fixes I've made anyway.

?_embed

Should post support ?_embed attr on ${typePrefix}posts ( ${typePrefix}posts?_embed) ?
It will be awesome to be able to added to the feature image data. Possible? Feature?

Starter chokes on tagless posts

This is tricky because the tag pages can't really exist unless at least 1 tag exists in the source site.

Probably best to just note this as a hard requirement rather than try to support it.

Permalink structure for posts?

Is it possible to change the post permalink structure?
in WP I have set it to :

/%year%/%monthnum%/%day%/%postname%/

so the output would be

/2019/01/20/sample-post/

how can I get the similar custom links?

ACF / Prism WP

Just having some issues trying to get Advanced Custom Fields working. I've set them up on my WordPress site but get errors when I try to query them (even using http://WEBSITEURL/___graphql). The rest of the query works perfectly fine, I can get the default WP fields and display that on my website.

And what exactly is this Prism WP plugin you reference to at the end of the documentation, and how does it pass down code blocks to help with acf?

UPDATE

I didnt have the correct Wordpress plugins installed and that was why I was not getting acf working. I am still interested to know what exactly Prism WP is supposed to achieve?

Anyone else with future issues reffer back to here

TypeError: Cannot convert undefined or null to object

Description

when baseUrl: 'engineersf.com in gatsby-config.js:

  TypeError: Cannot convert undefined or null to object
  
  - Function.keys
  
  - fetch.js:534 getValidRoutes
    [engineersf]/[gatsby-source-wordpress]/fetch.js:534:26
  
  - fetch.js:148 fetch
    [engineersf]/[gatsby-source-wordpress]/fetch.js:148:23
  
  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7

when run with baseUrl: 'wpdemo.gatsbycentral.com' that comes with the wordpress starter it works.

strangely allRoutes.data at fetch.js:534 is not an object and appears to be a json string, which I suspect is the root cause.

Steps to reproduce

https://github.com/danny-waite/engineersf.com

Environment

System:
OS: macOS 10.14.3
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.15.3/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 76.0.3809.132
Safari: 12.0.3
npmPackages:
gatsby: ^2.15.14 => 2.15.14
gatsby-awesome-pagination: ^0.3.3 => 0.3.4
gatsby-plugin-lodash: ^3.1.7 => 3.1.7
gatsby-plugin-netlify: ^2.1.12 => 2.1.12
gatsby-plugin-purgecss: ^4.0.1 => 4.0.1
gatsby-plugin-react-helmet: ^3.1.7 => 3.1.7
gatsby-plugin-sass: ^2.1.14 => 2.1.14
gatsby-plugin-sharp: ^2.2.21 => 2.2.21
gatsby-remark-images: ^3.1.21 => 3.1.21
gatsby-source-filesystem: ^2.1.22 => 2.1.22
gatsby-source-wordpress: ^3.1.31 => 3.1.31
gatsby-transformer-remark: ^2.6.22 => 2.6.22
gatsby-transformer-sharp: ^2.2.14 => 2.2.14
npmGlobalPackages:
gatsby-cli: 2.7.47

Continue reading - Wordpress theme

Hi,
I have downloaded the Wordpress theme for me. So far it workes fine. If i put a longer article on i can set up the number of words for the teaser. the theme shows a "continue reading" link which has to point to the article. Unfortunately it points the the same site. (e.g. if the site is names hamradio and the article is named radio1, it points to the hamradio site.)
if i klick on the Link to the article itself it points to the right target (the article)

can you give me a hint where i can fix that or even change the target of the "continue reading" link?

cheers
Lars

Won't generate pages from WordPress.com-hosted site

I can't seem to get this to crawl a site I have hosted with WordPress.com successfully. The relevant part of my Gatsby config is as follows:

  options: {
    baseUrl: WP_URL, // e.g. "demo1234.wordpress.com"
    hostingWPCOM: true,
    protocol: "http",
    useACF: false,
    auth: {
      wpcom_app_clientId: WP_CLIENT_ID,
      wpcom_app_clientSecret: WP_CLIENT_SECRET
      wpcom_user: WP_USER_EMAIL,
      wpcom_pass: WP_USER_PASSWORD
    },
    verboseOutput: true
  }

From the verbose output, I get the following error:

=START PLUGIN=====================================

Site URL: http://demo1234.wordpress.com
Site hosted on Wordpress.com: true
Using ACF: false
Using Auth: undefined undefined
Verbose output: true

Mama Route URL: https://public-api.wordpress.com/wp/v2/sites/demo1234.wordpress.com

I then get a raft of "Invalid route" notifications, amongst a few valid ones—it seems to relate to any param-based URLs:

⡀ source and transform nodesRoute discovered : /wp/v2
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/posts/(?P<parent>[\d]+)/autosaves
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/posts/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/pages/(?P<parent>[\d]+)/autosaves
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/pages/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/posts
Valid route found. Will try to fetch.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/posts/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/posts/(?P<parent>[\d]+)/revisions
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/posts/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/sites/demo1234.wordpress.com/pages
Valid route found. Will try to fetch.
…
=END PLUGIN=====================================: 5962.415ms
success source and transform nodes — 6.704 s
success building schema — 0.369 s
success createLayouts — 0.030 s
⠂ createPages

At this point, createPages seems to hang and not produce any output. It doesn't exit, and doesn't produce any errors to the console; it just seems to be waiting for something?

Does anyone know what might be happening here, please?

How can I fetch a new post?

Hi there,

Is it possible to fetch post automatically? or should be I run gatsby build after new posts?

Thank you

Error after updating npm

Hello. Thanks for what looks like an excellent way of hooking up Gatsby and WP!

But. I'm seeing an error after updating npm.

Steps to reproduce:

gatsby new concinity2 https://github.com/GatsbyCentral/gatsby-starter-wordpress
cd concinnity2

Minimal edits to gatsby-config.js:

module.exports = {
  siteMetadata: {
    title: 'Concinnity website',
  },
  plugins: [
    'gatsby-plugin-react-helmet',
    'gatsby-plugin-sass',
    {
      resolve: 'gatsby-source-wordpress',
      options: {
        // The base url to your WP site.
        baseUrl: 'concinnity-wp.test',
        // WP.com sites set to true, WP.org set to false
        hostingWPCOM: false,
        // The protocol. This can be http or https.
        protocol: 'https',
        // Use 'Advanced Custom Fields' Wordpress plugin
        useACF: false,
        auth: {},
        // Set to true to debug endpoints on 'gatsby build'
        verboseOutput: true,
      },
    },
    'gatsby-plugin-sharp',
    'gatsby-transformer-sharp',
    'gatsby-plugin-purgecss',
    'gatsby-plugin-netlify', // make sure to keep it last in the array
  ],
}

Edit gatsby-node.js to work with local cert for wordpress. Nothing else is changed:

const _ = require('lodash')
const path = require('path')
const { createFilePath } = require('gatsby-source-filesystem')
const { paginate } = require('gatsby-awesome-pagination')

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

const getOnlyPublished = edges =>
  _.filter(edges, ({ node }) => node.status === 'publish')

...
-> % gatsby develop
success open and validate gatsby-config — 0.008 s
success load plugins — 0.205 s
success onPreInit — 0.780 s
success delete html and css files from previous builds — 0.005 s
success initialize cache — 0.006 s
success copy gatsby files — 0.033 s
success onPreBootstrap — 0.003 s
⠁
=START PLUGIN=====================================

Site URL: https://concinnity-wp.test
Site hosted on Wordpress.com: false
Using ACF: false
Auth: false
Verbose output: true

Mama Route URL: https://concinnity-wp.test/wp-json

(node:19464) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
⠄ source and transform nodesRoute discovered : /
Excluded route: blacklisted
Route discovered : /oembed/1.0
Excluded route: blacklisted
Route discovered : /oembed/1.0/embed
Excluded route: blacklisted
Route discovered : /oembed/1.0/proxy
Excluded route: blacklisted
Route discovered : /wp/v2
Valid route found. Will try to fetch.
Route discovered : /wp/v2/posts
Valid route found. Will try to fetch.
Route discovered : /wp/v2/posts/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/revisions
Invalid route: detail route
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/posts/(?P<id>[\d]+)/autosaves
Invalid route: detail route
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/pages
Valid route found. Will try to fetch.
Route discovered : /wp/v2/pages/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/revisions
Invalid route: detail route
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/pages/(?P<id>[\d]+)/autosaves
Invalid route: detail route
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/media
Valid route found. Will try to fetch.
Route discovered : /wp/v2/media/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/blocks
Valid route found. Will try to fetch.
Route discovered : /wp/v2/blocks/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/blocks/(?P<id>[\d]+)/autosaves
Invalid route: detail route
Route discovered : /wp/v2/blocks/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/types
Valid route found. Will try to fetch.
Route discovered : /wp/v2/types/(?P<type>[\w-]+)
Invalid route: detail route
Route discovered : /wp/v2/statuses
Valid route found. Will try to fetch.
Route discovered : /wp/v2/statuses/(?P<status>[\w-]+)
Invalid route: detail route
Route discovered : /wp/v2/taxonomies
Valid route found. Will try to fetch.
Route discovered : /wp/v2/taxonomies/(?P<taxonomy>[\w-]+)
Invalid route: detail route
Route discovered : /wp/v2/categories
Valid route found. Will try to fetch.
Route discovered : /wp/v2/categories/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/tags
Valid route found. Will try to fetch.
Route discovered : /wp/v2/tags/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/users
Valid route found. Will try to fetch.
Route discovered : /wp/v2/users/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/users/me
Valid route found. Will try to fetch.
Route discovered : /wp/v2/comments
Valid route found. Will try to fetch.
Route discovered : /wp/v2/comments/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/search
Valid route found. Will try to fetch.
Route discovered : /wp/v2/block-renderer/(?P<name>core/block)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/latest-comments)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/archives)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/categories)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/latest-posts)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/shortcode)
Invalid route: detail route
Route discovered : /wp/v2/settings
Valid route found. Will try to fetch.
Route discovered : /wp/v2/themes
Valid route found. Will try to fetch.

Fetching the JSON data from 16 valid API Routes...

=== [ Fetching wordpress__wp_v2 ] === https://concinnity-wp.test/wp-json/wp/v2
⡀ source and transform nodes -> wordpress__wp_v2 fetched : 1
Fetching the wordpress__wp_v2 took: 30.033ms

=== [ Fetching wordpress__POST ] === https://concinnity-wp.test/wp-json/wp/v2/posts
⢀ source and transform nodes -> wordpress__POST fetched : 1
Fetching the wordpress__POST took: 64.573ms

=== [ Fetching wordpress__PAGE ] === https://concinnity-wp.test/wp-json/wp/v2/pages
 -> wordpress__PAGE fetched : 3
Fetching the wordpress__PAGE took: 25.155ms

=== [ Fetching wordpress__wp_media ] === https://concinnity-wp.test/wp-json/wp/v2/media
⠠ source and transform nodes -> wordpress__wp_media fetched : 1
Fetching the wordpress__wp_media took: 21.134ms

=== [ Fetching wordpress__wp_blocks ] === https://concinnity-wp.test/wp-json/wp/v2/blocks
 -> wordpress__wp_blocks fetched : 0
Fetching the wordpress__wp_blocks took: 16.688ms

=== [ Fetching wordpress__wp_types ] === https://concinnity-wp.test/wp-json/wp/v2/types
 -> wordpress__wp_types fetched : 1
Fetching the wordpress__wp_types took: 13.903ms

=== [ Fetching wordpress__wp_statuses ] === https://concinnity-wp.test/wp-json/wp/v2/statuses
 -> wordpress__wp_statuses fetched : 1
Fetching the wordpress__wp_statuses took: 13.006ms

=== [ Fetching wordpress__wp_taxonomies ] === https://concinnity-wp.test/wp-json/wp/v2/taxonomies
⠐ source and transform nodes -> wordpress__wp_taxonomies fetched : 1
Fetching the wordpress__wp_taxonomies took: 14.620ms

=== [ Fetching wordpress__CATEGORY ] === https://concinnity-wp.test/wp-json/wp/v2/categories
 -> wordpress__CATEGORY fetched : 1
Fetching the wordpress__CATEGORY took: 16.575ms

=== [ Fetching wordpress__TAG ] === https://concinnity-wp.test/wp-json/wp/v2/tags
 -> wordpress__TAG fetched : 1
Fetching the wordpress__TAG took: 14.969ms

=== [ Fetching wordpress__wp_users ] === https://concinnity-wp.test/wp-json/wp/v2/users
 -> wordpress__wp_users fetched : 1
Fetching the wordpress__wp_users took: 17.675ms

=== [ Fetching wordpress__wp_me ] === https://concinnity-wp.test/wp-json/wp/v2/users/me
⠈ source and transform nodes
Path: /wp-json/wp/v2/users/me?per_page=100&page=1
The server response was "401 Unauthorized"
Inner exception message: "You are not currently logged in."
Fetching the wordpress__wp_me took: 14.095ms

=== [ Fetching wordpress__wp_comments ] === https://concinnity-wp.test/wp-json/wp/v2/comments
 -> wordpress__wp_comments fetched : 1
Fetching the wordpress__wp_comments took: 17.726ms

=== [ Fetching wordpress__wp_search ] === https://concinnity-wp.test/wp-json/wp/v2/search
 -> wordpress__wp_search fetched : 4
Fetching the wordpress__wp_search took: 19.711ms

=== [ Fetching wordpress__wp_settings ] === https://concinnity-wp.test/wp-json/wp/v2/settings
⠁ source and transform nodes
Path: /wp-json/wp/v2/settings?per_page=100&page=1
The server response was "401 Unauthorized"
Inner exception message: "Sorry, you are not allowed to do that."
Fetching the wordpress__wp_settings took: 17.266ms

=== [ Fetching wordpress__wp_themes ] === https://concinnity-wp.test/wp-json/wp/v2/themes

Path: /wp-json/wp/v2/themes?per_page=100&page=1
The server response was "400 Bad Request"
Inner exception message: "Missing parameter(s): status"
Fetching the wordpress__wp_themes took: 14.421ms

=END PLUGIN=====================================: 492.892ms
success source and transform nodes — 0.561 s
success building schema — 0.431 s
success createPages — 0.097 s
success createPagesStatefully — 0.024 s
success onPreExtractQueries — 0.003 s
success update schema — 0.247 s
success extract queries from components — 0.156 s
success run graphql queries — 0.080 s — 12/12 153.22 queries/second
success write out page data — 0.005 s
success write out redirect data — 0.001 s
success onPostBootstrap — 0.001 s

info bootstrap finished - 6.392 s

 DONE  Compiled successfully in 3167ms                                                                        9:13:04 AM


You can now view gatsby-starter-wordpress in the browser.

  http://localhost:8000/

View GraphiQL, an in-browser IDE, to explore your site's data and schema

  http://localhost:8000/___graphql

Note that the development build is not optimized.
To create a production build, use gatsby build

ℹ 「wdm」:
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...

Works as expected.

Now update npm.

npm update

When I now run gatsby develop I'm seeing this:

-> % gatsby develop
success open and validate gatsby-configs — 0.008 s
success load plugins — 0.203 s
success onPreInit — 0.509 s
success delete html and css files from previous builds — 0.011 s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's not any stale
data
success initialize cache — 0.016 s
success copy gatsby files — 0.042 s
success onPreBootstrap — 0.004 s
⠁
=START PLUGIN=====================================

Site URL: https://concinnity-wp.test
Site hosted on Wordpress.com: false
Using ACF: false
Auth: false
Verbose output: true

Mama Route URL: https://concinnity-wp.test/wp-json

(node:20783) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
⠂ source and transform nodesRoute discovered : /
Excluded route: blacklisted
Route discovered : /oembed/1.0
Excluded route: blacklisted
Route discovered : /oembed/1.0/embed
Excluded route: blacklisted
Route discovered : /oembed/1.0/proxy
Excluded route: blacklisted
Route discovered : /wp/v2
Valid route found. Will try to fetch.
Route discovered : /wp/v2/posts
Valid route found. Will try to fetch.
Route discovered : /wp/v2/posts/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/revisions
Invalid route: detail route
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/posts/(?P<id>[\d]+)/autosaves
Invalid route: detail route
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/pages
Valid route found. Will try to fetch.
Route discovered : /wp/v2/pages/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/revisions
Invalid route: detail route
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/pages/(?P<id>[\d]+)/autosaves
Invalid route: detail route
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/media
Valid route found. Will try to fetch.
Route discovered : /wp/v2/media/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/blocks
Valid route found. Will try to fetch.
Route discovered : /wp/v2/blocks/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/blocks/(?P<id>[\d]+)/autosaves
Invalid route: detail route
Route discovered : /wp/v2/blocks/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/types
Valid route found. Will try to fetch.
Route discovered : /wp/v2/types/(?P<type>[\w-]+)
Invalid route: detail route
Route discovered : /wp/v2/statuses
Valid route found. Will try to fetch.
Route discovered : /wp/v2/statuses/(?P<status>[\w-]+)
Invalid route: detail route
Route discovered : /wp/v2/taxonomies
Valid route found. Will try to fetch.
Route discovered : /wp/v2/taxonomies/(?P<taxonomy>[\w-]+)
Invalid route: detail route
Route discovered : /wp/v2/categories
Valid route found. Will try to fetch.
Route discovered : /wp/v2/categories/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/tags
Valid route found. Will try to fetch.
Route discovered : /wp/v2/tags/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/users
Valid route found. Will try to fetch.
Route discovered : /wp/v2/users/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/users/me
Valid route found. Will try to fetch.
Route discovered : /wp/v2/comments
Valid route found. Will try to fetch.
Route discovered : /wp/v2/comments/(?P<id>[\d]+)
Invalid route: detail route
Route discovered : /wp/v2/search
Valid route found. Will try to fetch.
Route discovered : /wp/v2/block-renderer/(?P<name>core/block)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/latest-comments)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/archives)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/categories)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/latest-posts)
Invalid route: detail route
Route discovered : /wp/v2/block-renderer/(?P<name>core/shortcode)
Invalid route: detail route
Route discovered : /wp/v2/settings
Valid route found. Will try to fetch.
Route discovered : /wp/v2/themes
Valid route found. Will try to fetch.

Fetching the JSON data from 16 valid API Routes...

=== [ Fetching wordpress__wp_v2 ] === https://concinnity-wp.test/wp-json/wp/v2
 -> wordpress__wp_v2 fetched : 1
Fetching the wordpress__wp_v2 took: 28.816ms

=== [ Fetching wordpress__POST ] === https://concinnity-wp.test/wp-json/wp/v2/posts
⠄ source and transform nodes -> wordpress__POST fetched : 1
Fetching the wordpress__POST took: 31.681ms

=== [ Fetching wordpress__PAGE ] === https://concinnity-wp.test/wp-json/wp/v2/pages
 -> wordpress__PAGE fetched : 3
Fetching the wordpress__PAGE took: 27.803ms

=== [ Fetching wordpress__wp_media ] === https://concinnity-wp.test/wp-json/wp/v2/media
⡀ source and transform nodes -> wordpress__wp_media fetched : 1
Fetching the wordpress__wp_media took: 23.028ms

=== [ Fetching wordpress__wp_blocks ] === https://concinnity-wp.test/wp-json/wp/v2/blocks
 -> wordpress__wp_blocks fetched : 0
Fetching the wordpress__wp_blocks took: 15.476ms

=== [ Fetching wordpress__wp_types ] === https://concinnity-wp.test/wp-json/wp/v2/types
 -> wordpress__wp_types fetched : 1
Fetching the wordpress__wp_types took: 15.701ms

=== [ Fetching wordpress__wp_statuses ] === https://concinnity-wp.test/wp-json/wp/v2/statuses
 -> wordpress__wp_statuses fetched : 1
Fetching the wordpress__wp_statuses took: 13.511ms

=== [ Fetching wordpress__wp_taxonomies ] === https://concinnity-wp.test/wp-json/wp/v2/taxonomies
⢀ source and transform nodes -> wordpress__wp_taxonomies fetched : 1
Fetching the wordpress__wp_taxonomies took: 18.135ms

=== [ Fetching wordpress__CATEGORY ] === https://concinnity-wp.test/wp-json/wp/v2/categories
 -> wordpress__CATEGORY fetched : 1
Fetching the wordpress__CATEGORY took: 15.344ms

=== [ Fetching wordpress__TAG ] === https://concinnity-wp.test/wp-json/wp/v2/tags
 -> wordpress__TAG fetched : 1
Fetching the wordpress__TAG took: 18.444ms

=== [ Fetching wordpress__wp_users ] === https://concinnity-wp.test/wp-json/wp/v2/users
 -> wordpress__wp_users fetched : 1
Fetching the wordpress__wp_users took: 15.030ms

=== [ Fetching wordpress__wp_me ] === https://concinnity-wp.test/wp-json/wp/v2/users/me
⠠ source and transform nodes
Path: /wp-json/wp/v2/users/me?per_page=100&page=1
The server response was "401 Unauthorized"
Inner exception message: "You are not currently logged in."
Fetching the wordpress__wp_me took: 20.644ms

=== [ Fetching wordpress__wp_comments ] === https://concinnity-wp.test/wp-json/wp/v2/comments
 -> wordpress__wp_comments fetched : 1
Fetching the wordpress__wp_comments took: 16.720ms

=== [ Fetching wordpress__wp_search ] === https://concinnity-wp.test/wp-json/wp/v2/search
 -> wordpress__wp_search fetched : 4
Fetching the wordpress__wp_search took: 18.948ms

=== [ Fetching wordpress__wp_settings ] === https://concinnity-wp.test/wp-json/wp/v2/settings
⠐ source and transform nodes
Path: /wp-json/wp/v2/settings?per_page=100&page=1
The server response was "401 Unauthorized"
Inner exception message: "Sorry, you are not allowed to do that."
Fetching the wordpress__wp_settings took: 14.462ms

=== [ Fetching wordpress__wp_themes ] === https://concinnity-wp.test/wp-json/wp/v2/themes

Path: /wp-json/wp/v2/themes?per_page=100&page=1
The server response was "400 Bad Request"
Inner exception message: "Missing parameter(s): status"
Fetching the wordpress__wp_themes took: 16.505ms

=END PLUGIN=====================================: 377.376ms
success source and transform nodes — 0.455 s
success building schema — 0.434 s
success createPages — 0.119 s
success createPagesStatefully — 0.033 s
success onPreExtractQueries — 0.003 s
success update schema — 0.294 s
error GraphQL Error Field "slug" is not defined by type wordpressPostConnectionCategoriesQueryList_2.

  file: /Users/gabriel/git/concinnity2/src/templates/category.js

   1 |
   2 |   query CategoryPage($slug: String!) {
   3 |     site {
   4 |       siteMetadata {
   5 |         title
   6 |       }
   7 |     }
>  8 |     allWordpressPost(filter: { categories: { slug: { eq: $slug } } }) {
     |                                              ^
   9 |       totalCount
  10 |       edges {
  11 |         node {
  12 |           ...PostListFields
  13 |         }
  14 |       }
  15 |     }
  16 |   }
  17 |

success extract queries from components — 0.113 s
⠁ (node:20783) DeprecationWarning: Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.
success run graphql queries — 0.018 s — 11/11 687.56 queries/second
success write out page data — 0.003 s
success write out redirect data — 0.000 s
success onPostBootstrap — 0.001 s

info bootstrap finished - 4.996 s

 DONE  Compiled successfully in 2976ms                                                                        9:15:31 AM


You can now view gatsby-starter-wordpress in the browser.

  http://localhost:8000/

View GraphiQL, an in-browser IDE, to explore your site's data and schema

  http://localhost:8000/___graphql

Note that the development build is not optimized.
To create a production build, use gatsby build

ℹ 「wdm」:
ℹ 「wdm」: Compiled successfully.

I'm lost! Visiting localhost:8000 renders the following:

Failed to compile
GraphQL Error Field "slug" is not defined by type wordpressPostConnectionCategoriesQueryList_2.

  file: /Users/gabriel/git/concinnity2/src/templates/category.js

   1 | 
   2 |   query CategoryPage($slug: String!) {
   3 |     site {
   4 |       siteMetadata {
   5 |         title
   6 |       }
   7 |     }
>  8 |     allWordpressPost(filter: { categories: { slug: { eq: $slug } } }) {
     |                                              ^
   9 |       totalCount
  10 |       edges {
  11 |         node {
  12 |           ...PostListFields
  13 |         }
  14 |       }
  15 |     }
  16 |   }
  17 | 
This error occurred during the build time and cannot be dismissed.

For now I can continue working with a non-updated repo, but this will be annoying in the long run and I have no clue to what's wrong. Any ideas?

Looking for maintainer...

Looking for maintainer: If you're interested in taking over the maintenance of this starter, please reach out in an issue. We're not working with Gatsby any more (it got way too complicated, hello nextjs), and so we're not maintaining this.

Hi. I am ready to maintaine this starter :)

Step by step guide

Let's create a step by step guide that tells folks how to get started with this starter. Would be great if we could somehow throw that as a message in the console when the user runs gatsby new ....

Updating gatsby package to latest (2.18.1) breaks gatsby develop

Description

As the title says, if you pull this starter and upgrade the gatsby package to the latest version, currently 2.18.1, running gatsby develop will throw errors and break. Current version in this package.json is 2.15.14

Steps to reproduce

  1. Pull this starter: npx gatsby new gatsby-starter-wordpress https://github.com/GatsbyCentral/gatsby-starter-wordpress
  2. cd gatsby-starter-wordpress
  3. npx gatsby develop
  4. Everything works fine, shut down dev server.
  5. npm install gatsby@latest
  6. npx gatsby develop
  7. Errors thrown and breaks.

Expected result

Dev server should start fine as before package update.

Actual result

Here is the error output:

The above error occurred in the <StoreStateProvider> component:
    in StoreStateProvider
    in App

React will try to recreate this component tree from scratch using the error boundary you provided, App.
Warning: App: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.

Environment

System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 78.0.3904.108
Firefox: 37.0.2
Safari: 13.0.2

Missing GraphQL queries (like allWordpressPage) when using this starter

When i run this starter in GraphQL i am missing a lot of queries and i also get build errors like:
Cannot query field "allWordpressPage" on type "Query". Did you mean "allSitePage"?

But when i start with gatsby-default-starter and add gatsby-source-wordpress i can see all of those missing queries.

401 Unauthorized error

I'm getting this error

Path: /wp-json/wp/v2/users/me?per_page=100&page=1
The server response was "401 Unauthorized"
Inner exception message: "You are not currently

"gatsby": "^2.11.6",

Bulma burger menu with all WordPress pages

As Bulma is used so how to integrate with all WordPress pages and burger menu?

There is a navbar.js file where GraphQL is used to pull all WordPress pages and its responsive but I think it would be great to use Bulma burger menu and all its functionalities i.e. Close icon and show all pages.

I used the following code to get a burger menu after navbar-brand.

<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navMenu"> <span aria-hidden="true"></span> <span aria-hidden="true"></span> <span aria-hidden="true"></span> </a>

But not sure how to show all pages and close icon!

Live site: https://nirvana.netlify.com/

Error: Cannot find module '../build/Release/sharp.node'

Hi,

I am discovering Gatsby and try this starter. I changed the baseUrl parameter in gatsby-config.js file. But when I run gatsby develop I have the following errors :

success open and validate gatsby-config — 0.009 s
success load plugins — 0.268 s
error Plugin gatsby-transformer-sharp returned an error


  Error: Cannot find module '../build/Release/sharp.node'

When I run npm install I have other errors :

> [email protected] install /Users/olivierthierry/Sites/gatsby-terresceltes/node_modules/deasync
> node ./build.js

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/olivierthierry/Sites/gatsby-terresceltes/node_modules/deasync
gyp ERR! node -v v11.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed

Am I missing something ?

Featured image URLs point to WP site

The featured image URL is from the WordPress site. This causes several issues:

  • Blind dependency on WP to host images
  • Potential for security warnings if WP is http instead of https

`Cannot query allWordpressWpUsers...` and `"author" must not have a selection` errors on initial build

Hi, I'm testing this out, and am getting a couple errors during the initial gatsby develop:

  • gatsby new test https://github.com/GatsbyCentral/gatsby-starter-wordpress
  • updated gatsby-config.js to set baseUrl : 'iandunn.name',
  • gatsby develop

Specifically:

Cannot query field "allWordpressWpUsers"

...and

Field "author" must not have a selection since type "Int" has no subfield

success Downloading remote files — 19/19 - 0.502 s
success source and transform nodes - 18.965 s
success Add explicit types - 0.018 s
warn Multiple node fields resolve to the same GraphQL field `wordpress__wp_media.guid` - [`guid___NODE`,
`guid`]. Gatsby will use `guid___NODE`.
success Add inferred types - 0.222 s
success Processing types - 0.142 s
warn There are conflicting field types in your data.

If you have explicitly defined a type for those fields, you can safely ignore this warning message.
Otherwise, Gatsby will omit those fields from the GraphQL schema.

If you know all field types in advance, the best strategy is to explicitly define them with the `createTypes`
action, and skip inference with the `@dontInfer` directive.
See https://www.gatsbyjs.org/docs/actions/#createTypes
wordpress__wp_media.media_details.width:
 - type: number
   value: 1696
 - type: string
   value: '403'
wordpress__wp_media.media_details.height:
 - type: date
   value: '1024'
 - type: number
   value: 722
 - type: string
   value: '403'
wordpress__wp_media.media_details.image_meta.aperture:
 - type: number
   value: 2.4
 - type: string
   value: '0'
wordpress__wp_media.media_details.image_meta.created_timestamp:
 - type: number
   value: 1039348800
 - type: string
   value: '0'
wordpress__wp_media.media_details.image_meta.focal_length:
 - type: number
   value: 0
 - type: string
   value: '0'
wordpress__wp_media.media_details.image_meta.iso:
 - type: number
   value: 0
 - type: string
   value: '0'
wordpress__wp_media.media_details.image_meta.shutter_speed:
 - type: number
   value: 0
 - type: string
   value: '0'
success building schema - 0.470 s
Cannot query field "allWordpressWpUsers" on type "Query". Did you mean "allWordpressWpSearch", "allWordpressWpTypes", "allWordpressWpStatuses", "allWordpressPage", or "allWordpressWpMedia"?

GraphQL request:3:11
2 |         {
3 |           allWordpressWpUsers {
  |           ^
4 |             edges {

 ERROR #11321  PLUGIN

"gatsby-node.js" threw an error while running the createPages lifecycle:

Cannot query field "allWordpressWpUsers" on type "Query". Did you mean "allWordpressWpSearch", "allWordpressWpTypes", "allWordpressWpStatuses", "allWordpressPage", or "allWordpressWpMedia"?

GraphQL request:3:11
2 |         {
3 |           allWordpressWpUsers {
  |           ^
4 |             edges {

success createPages - 0.555 s
success createPagesStatefully - 0.050 s
success onPreExtractQueries - 0.018 s
success update schema - 0.054 s

 ERROR #85909  GRAPHQL

Field "author" must not have a selection since type "Int" has no subfields

In the browser, it get this error:

GraphQL Error Field "author" must not have a selection since type "Int" has no subfields.

  file: /Users/iandunn/vhosts/localhost/gatsby/src/templates/post.js

I tried it with random site's baseUrl, though, and it worked fine.

If I switch back to my baseUrl, and then remove all the references to author and wordpressWpUsers, then it works.

Having a hard time with Featured Images

I'm really struggling to pull through featured images. I'm hoping I'm just doing something stupid or missing something.

So this is my query in PostList.js:

export const pageQuery = graphql`
  fragment PostListFields on wordpress__POST {
    id
    title
    excerpt
    author {
      name
      slug
      avatar_urls {
        wordpress_48
      }
    }
    date(formatString: "MMMM DD, YYYY")
    slug
    featured_media {
      localFile {
        childImageSharp {
          fluid(maxWidth: 1200){
            ...GatsbyImageSharpFluid
        }
      }
    }
  }
}
`

And I don't know if I'm wrong, but this is how I get my image:

<Img fluid={post.featured_media.localFile.childImageSharp.fluid}  />

And I've even tried:

<img src={post.featured_media.localFile.childImageSharp.src} />

What I end up with is an error that says:

TypeError: Cannot read property 'localFile' of null

And if I console.log(posts), I can even see the images:

featured_media:
localFile:
childImageSharp:
fluid:
aspectRatio: 1.7777777777777777
base64: "data:image/jpeg;base64,/9j/2wBDABALDA4MCh...etc etc 
sizes: "(max-width: 800px) 100vw, 800px"
src: "/static/cdffa355894ff255a99fe00bb5586590/b17c1/outsource-online-marketing1.jpg"
srcSet: "/static/cdffa355894ff255a99fe00bb5586590/00e5e/outsource-onl

I would be so grateful if someone could maybe just point me in the right direction!

unable to get contents from self-hosted wordpress

I tried everything. everytime it throws another error. at first it was complaining about author then acf etc.

I removed some graphql code to fix autorh, then acf. it did build but run into more errors.
here are my settings

const config = require('./data/SiteConfig')

const pathPrefix = config.pathPrefix === '/' ? '' : config.pathPrefix

module.exports = {
  pathPrefix: config.pathPrefix,
  siteMetadata: {
    siteUrl: config.siteUrl + pathPrefix,
    rssMetadata: {
      site_url: config.siteUrl + pathPrefix,
      feed_url: config.siteUrl + pathPrefix + config.siteRss,
      title: config.siteTitle,
      description: config.siteDescription,
      image_url: `${config.siteUrl + pathPrefix}/logos/logo-512.png`,
      author: config.userName,
      copyright: config.copyright
    }
  },
  plugins: [
    'gatsby-plugin-styled-components',
    'gatsby-plugin-react-helmet',
    {
      resolve: 'gatsby-source-wordpress',
      options: {
        // The base url to your WP site.
        baseUrl: 'blog.kamva.ir',
        // WP.com sites set to true, WP.org set to false
        hostingWPCOM: false,
        // The protocol. This can be http or https.
        protocol: 'http',
        // Use 'Advanced Custom Fields' Wordpress plugin
        useACF: false,
        auth: {},
        // Set to true to debug endpoints on 'gatsby build'
        verboseOutput: true
      }
    },
    {
      resolve: 'gatsby-plugin-nprogress',
      options: {
        color: config.themeColor
      }
    },
    'gatsby-plugin-sharp',
    'gatsby-plugin-catch-links',
    'gatsby-plugin-twitter',
    'gatsby-plugin-sitemap',
    {
      resolve: 'gatsby-plugin-manifest',
      options: {
        name: config.siteTitle,
        short_name: config.siteTitle,
        description: config.siteDescription,
        start_url: config.pathPrefix,
        background_color: config.backgroundColor,
        theme_color: config.themeColor,
        display: 'minimal-ui',
        icons: [
          {
            src: '/logos/logo-192x192.png',
            sizes: '192x192',
            type: 'image/png'
          },
          {
            src: '/logos/logo-512x512.png',
            sizes: '512x512',
            type: 'image/png'
          }
        ]
      }
    },
    'gatsby-plugin-offline'
  ]
}

tag.js file error

when I run gatsby develop it gives me this error

There was an error in your GraphQL query:

Field "tags" is not defined by type wordpress__POSTFilterInput. Did you mean status?

Images inside post content

Currently the images inside the post content point to the WordPress domain. It would be nice to find a way to import them and load them via <Image if that's possible...

Add `develop: true` to purgecss config

I was having an issue (see gatsbyjs/gatsby#12226) where style output was different in production than in development, and tracked it back to purgecss eliminating live styles. I'd recommend configuring purgecss as active in developer mode (and possibly also adding terminal output for purged selectors) using the following configuration. I'd imagine this to be an issue that would catch a lot of developers by surprise.

    {
      resolve: 'gatsby-plugin-purgecss', // purges all unused/unreferenced css rules
      options: {
        develop: true,            // Activates purging in npm run develop
        printRejected: true  // Show purged CSS selectors in terminal output
      },
    },

Can't Query Wordpress

I've got the WordPress plugin installed ("gatsby-source-wordpress": "^2.0.58") but every time I go to http://localhost:8000/___graphql and try to query allWordpressPost I get this error:

GraphQL Error There was an error while compiling your site's GraphQL queries.
Invariant Violation: GraphQLParser: Unknown field allWordpressPost on type RootQueryType. Source: document IndexQuery file: GraphQL request.

Did I install the something incorrect? Seems like the gatsby-source-wordpress plugin isn't working right. But, I'm new to this. Thoughts?

Authenticating Private WP Endpoints

Hi,

Thanks for making this plugin for Gatsby. I'm new to Wordpress and Gatsby, so please let me know if there are things I'm misunderstanding.

While trying to run gatsby develop, I get the following error (using verbose mode):

=START PLUGIN=====================================

Site URL: http://46.101.73.50
Site hosted on Wordpress.com: false
Using ACF: true
Using Auth: <email> <password>
Verbose output: true

Mama Route URL: http://46.101.73.50/wp-json

⠁ source and transform nodesRoute discovered : /
Invalid route.
Route discovered : /oembed/1.0
Invalid route.
Route discovered : /oembed/1.0/embed
Invalid route.
Route discovered : /oembed/1.0/proxy
Invalid route.
Route discovered : /acf/v3
Invalid route.
Route discovered : /acf/v3/posts/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/posts
Valid route found. Will try to fetch.
Route discovered : /acf/v3/pages/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/pages
Valid route found. Will try to fetch.
Route discovered : /acf/v3/media/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/media
Valid route found. Will try to fetch.
Route discovered : /acf/v3/albums/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/albums
Valid route found. Will try to fetch.
Route discovered : /acf/v3/categories/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/categories
Valid route found. Will try to fetch.
Route discovered : /acf/v3/tags/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/tags
Valid route found. Will try to fetch.
Route discovered : /acf/v3/comments/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/comments
Valid route found. Will try to fetch.
Route discovered : /acf/v3/options/(?P<id>[\w\-\_]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/users/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/users
Valid route found. Will try to fetch.
Route discovered : /wp/v2
Invalid route.
Route discovered : /wp/v2/posts
Valid route found. Will try to fetch.
Route discovered : /wp/v2/posts/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/revisions
Invalid route.
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/pages
Valid route found. Will try to fetch.
Route discovered : /wp/v2/pages/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/revisions
Invalid route.
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/media
Valid route found. Will try to fetch.
Route discovered : /wp/v2/media/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/albums
Valid route found. Will try to fetch.
Route discovered : /wp/v2/albums/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/types
Valid route found. Will try to fetch.
Route discovered : /wp/v2/types/(?P<type>[\w-]+)
Invalid route.
Route discovered : /wp/v2/statuses
Valid route found. Will try to fetch.
Route discovered : /wp/v2/statuses/(?P<status>[\w-]+)
Invalid route.
Route discovered : /wp/v2/taxonomies
Valid route found. Will try to fetch.
Route discovered : /wp/v2/taxonomies/(?P<taxonomy>[\w-]+)
Invalid route.
Route discovered : /wp/v2/categories
Valid route found. Will try to fetch.
Route discovered : /wp/v2/categories/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/tags
Valid route found. Will try to fetch.
Route discovered : /wp/v2/tags/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/users
Valid route found. Will try to fetch.
Route discovered : /wp/v2/users/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/users/me
Valid route found. Will try to fetch.
Route discovered : /wp/v2/comments
Valid route found. Will try to fetch.
Route discovered : /wp/v2/comments/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/settings
Valid route found. Will try to fetch.
Added ACF Options route.

Fetching the JSON data from 22 valid API Routes...

=== [ Fetching wordpress__acf_posts ] === http://46.101.73.50/wp-json/acf/v3/posts
⠈ source and transform nodes -> wordpress__acf_posts fetched : 1
Fetching the wordpress__acf_posts took: 435.839ms

=== [ Fetching wordpress__acf_pages ] === http://46.101.73.50/wp-json/acf/v3/pages
⠐ source and transform nodes -> wordpress__acf_pages fetched : 1
Fetching the wordpress__acf_pages took: 452.916ms

=== [ Fetching wordpress__acf_media ] === http://46.101.73.50/wp-json/acf/v3/media
⠈ source and transform nodes -> wordpress__acf_media fetched : 1
Fetching the wordpress__acf_media took: 541.594ms

=== [ Fetching wordpress__acf_albums ] === http://46.101.73.50/wp-json/acf/v3/albums
⠈ source and transform nodes -> wordpress__acf_albums fetched : 2
Fetching the wordpress__acf_albums took: 501.412ms

=== [ Fetching wordpress__acf_categories ] === http://46.101.73.50/wp-json/acf/v3/categories
⠠ source and transform nodes -> wordpress__acf_categories fetched : 1
Fetching the wordpress__acf_categories took: 410.631ms

=== [ Fetching wordpress__acf_tags ] === http://46.101.73.50/wp-json/acf/v3/tags
⢀ source and transform nodes -> wordpress__acf_tags fetched : 0
Fetching the wordpress__acf_tags took: 447.599ms

=== [ Fetching wordpress__acf_comments ] === http://46.101.73.50/wp-json/acf/v3/comments
⢀ source and transform nodes -> wordpress__acf_comments fetched : 1
Fetching the wordpress__acf_comments took: 471.036ms

=== [ Fetching wordpress__acf_users ] === http://46.101.73.50/wp-json/acf/v3/users
⠠ source and transform nodes -> wordpress__acf_users fetched : 1
Fetching the wordpress__acf_users took: 613.977ms

=== [ Fetching wordpress__POST ] === http://46.101.73.50/wp-json/wp/v2/posts
⢀ source and transform nodes -> wordpress__POST fetched : 1
Fetching the wordpress__POST took: 396.372ms

=== [ Fetching wordpress__PAGE ] === http://46.101.73.50/wp-json/wp/v2/pages
⡀ source and transform nodes -> wordpress__PAGE fetched : 1
Fetching the wordpress__PAGE took: 419.524ms

=== [ Fetching wordpress__wp_media ] === http://46.101.73.50/wp-json/wp/v2/media
⠂ source and transform nodes -> wordpress__wp_media fetched : 1
Fetching the wordpress__wp_media took: 426.478ms

=== [ Fetching wordpress__wp_albums ] === http://46.101.73.50/wp-json/wp/v2/albums
⠁ source and transform nodes -> wordpress__wp_albums fetched : 2
Fetching the wordpress__wp_albums took: 452.975ms

=== [ Fetching wordpress__wp_types ] === http://46.101.73.50/wp-json/wp/v2/types
⠈ source and transform nodes -> wordpress__wp_types fetched : 1
Fetching the wordpress__wp_types took: 428.286ms

=== [ Fetching wordpress__wp_statuses ] === http://46.101.73.50/wp-json/wp/v2/statuses
⠈ source and transform nodes -> wordpress__wp_statuses fetched : 1
Fetching the wordpress__wp_statuses took: 462.136ms

=== [ Fetching wordpress__wp_taxonomies ] === http://46.101.73.50/wp-json/wp/v2/taxonomies
⠐ source and transform nodes -> wordpress__wp_taxonomies fetched : 1
Fetching the wordpress__wp_taxonomies took: 442.324ms

=== [ Fetching wordpress__CATEGORY ] === http://46.101.73.50/wp-json/wp/v2/categories
⠠ source and transform nodes -> wordpress__CATEGORY fetched : 1
Fetching the wordpress__CATEGORY took: 429.815ms

=== [ Fetching wordpress__TAG ] === http://46.101.73.50/wp-json/wp/v2/tags
⠐ source and transform nodes -> wordpress__TAG fetched : 0
Fetching the wordpress__TAG took: 575.654ms

=== [ Fetching wordpress__wp_users ] === http://46.101.73.50/wp-json/wp/v2/users
⠠ source and transform nodes -> wordpress__wp_users fetched : 1
Fetching the wordpress__wp_users took: 447.426ms

=== [ Fetching wordpress__wp_me ] === http://46.101.73.50/wp-json/wp/v2/users/me
⡀ source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "You are not currently logged in."
Fetching the wordpress__wp_me took: 411.293ms

=== [ Fetching wordpress__wp_comments ] === http://46.101.73.50/wp-json/wp/v2/comments
⠄ source and transform nodes -> wordpress__wp_comments fetched : 1
Fetching the wordpress__wp_comments took: 445.704ms

=== [ Fetching wordpress__wp_settings ] === http://46.101.73.50/wp-json/wp/v2/settings
⠄ source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "Sorry, you are not allowed to do that."
Fetching the wordpress__wp_settings took: 477.208ms

=== [ Fetching wordpress__acf_options ] === http://46.101.73.50/wp-json/acf/v2/options
⠂ source and transform nodesThe server response was "404 Not Found"
Inner exception message : "No route was found matching the URL and request method"
Fetching the wordpress__acf_options took: 440.540ms

=END PLUGIN=====================================: 11135.032ms
success source and transform nodes — 12.059 s
success building schema — 0.424 s
success createLayouts — 0.012 s
⠁ createPages

and it stalls there.

I've tried adding the following to no avail (I haven't touch the .htaccess on this freshly created WP instance):

auth: {
  'htaccess_user': '<email>',
  'htaccess_pass': '<password>',
},

In REST API docs by Wordpress, a few authentication approaches for production use are suggested, just as JWT or OAuth 1.0. Though, under inspection, it looks like only the htaccess_user and htaccess_pass keys are pulled from the auth section of gatsby-config.js.

Using this plugin, how can I setup a production-ready authentication approach for working with the WP REST API, so that builds don't fail when accessing endpoints such as http://46.101.73.50/wp-json/wp/v2/settings?

There was an error in your GraphQL query

This happened to every website I try to run locally simultaneously:

There was an error in your GraphQL query:
The fragment "PostListFields" does not exist.

here was an error in your GraphQL query:

Field "author" must not have a selection since type "Int" has no subfields.

This can happen if you e.g. accidentally added { } to the field "author". If you didn't expect "author" to be of type "Int" make sure that your input source and/or plugin is correct.

File: src/components/PostList.js:76:12


 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "author" must not have a selection since type "Int" has no subfields.

This can happen if you e.g. accidentally added { } to the field "author". If you didn't expect "author" to be of type "Int" make sure that your input source and/or plugin is correct.

File: src/templates/post.js:153:14


 ERROR #85908  GRAPHQL

There was an error in your GraphQL query:

The fragment "PostListFields" does not exist.

  38 | export const pageQuery = graphql`
  39 |   query AuthorPage($id: String!) {
  40 |     site {
  41 |       siteMetadata {
  42 |         title
  43 |       }
  44 |     }
  45 |     wordpressWpUsers(id: { eq: $id }) {
  46 |       name
  47 |       authored_wordpress__POST {
> 48 |         ...PostListFields
     |         ^^^^^^^^^^^^^^^^^
  49 |       }
  50 |     }
  51 |   }
  52 | `
  53 |

File: src/templates/author.js


 ERROR #85908  GRAPHQL

There was an error in your GraphQL query:

The fragment "PostListFields" does not exist.

  33 |
  34 | export const pageQuery = graphql`
  35 |   query IndexQuery($limit: Int!, $skip: Int!) {
  36 |     allWordpressPost(
  37 |       sort: { fields: date, order: DESC }
  38 |       limit: $limit
  39 |       skip: $skip
  40 |     ) {
  41 |       edges {
  42 |         node {
> 43 |           ...PostListFields
     |           ^^^^^^^^^^^^^^^^^
  44 |         }
  45 |       }
  46 |     }
  47 |   }
  48 | `
  49 |

File: src/templates/blog.js


 ERROR #85908  GRAPHQL

There was an error in your GraphQL query:

The fragment "PostListFields" does not exist.

  35 |       siteMetadata {
  36 |         title
  37 |       }
  38 |     }
  39 |     allWordpressPost(
  40 |       filter: { categories: { elemMatch: { slug: { eq: $slug } } } }
  41 |     ) {
  42 |       totalCount
  43 |       edges {
  44 |         node {
> 45 |           ...PostListFields
     |           ^^^^^^^^^^^^^^^^^
  46 |         }
  47 |       }
  48 |     }
  49 |   }
  50 | `
  51 |

File: src/templates/category.js


 ERROR #85908  GRAPHQL

There was an error in your GraphQL query:

The fragment "PostListFields" does not exist.

  33 |   query TagPage($slug: String!) {
  34 |     site {
  35 |       siteMetadata {
  36 |         title
  37 |       }
  38 |     }
  39 |     allWordpressPost(filter: { tags: { elemMatch: { slug: { eq: $slug } } } }) {
  40 |       totalCount
  41 |       edges {
  42 |         node {
> 43 |           ...PostListFields
     |           ^^^^^^^^^^^^^^^^^
  44 |         }
  45 |       }
  46 |     }
  47 |   }
  48 | `
  49 |

File: src/templates/tag.js

failed extract queries from components - 0.956s

File: src/templates/author.js

Posts are not generated in production mode

Hello everyone!

Everything works fine in dev environment (gatsby develop) but when I build for production there is an issue. When I run gatsby build and then gatsby serve every post page is not generated. You can't open any post, you get a 404.

In fact at build time it prints this warning:

warning The GraphQL query in the non-page component "/Users/anagstef/repos/test-gatsby-build/src/templates/post.js" will not be run.
Exported queries are only executed for Page components. Instead of an exported
query, either co-locate a GraphQL fragment and compose that fragment into the
query (or other fragment) of the top-level page that renders this component, or
use a <StaticQuery> in this component. For more info on fragments and
composition, see http://graphql.org/learn/queries/#fragments and for more
information on <StaticQuery>, see https://next.gatsbyjs.org/docs/static-query

Happy to help with this, if I can do it (I have no experience with GraphQL).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.