Open giodc opened 2 years ago
Hey @giodc
Great to hear you are using my theme!
Setting the blog archive page in the WP settings should be all you need to do.
What version of WPGraphQL
, WPGatsby
, and gatsby-source-wordpress
are you using?
You can also try running gatsby develop --verbose
to see additional console logs
If it is actually building the archive page you should see Creating ${archive.graphqlSingleName} at ${uri}
Also, please try this query in http://localhost:8000/___graphql
and see if the post
post type shows up with the correct archivePath
query WpContentTypes {
allWpContentType {
nodes {
archivePath
graphqlSingleName
}
}
}
The theme is using this archivePath as the URL to pass to the createPage
function in gatsby-node.
Also! Please try gatsby clean
and let me know if that fixed it.
👍
Thank you Caleb! great plugin ;)
results from the query:
{
"data": {
"allWpContentType": {
"nodes": [
{
"archivePath": "/blog/",
"graphqlSingleName": "post"
},
{
"archivePath": null,
"graphqlSingleName": "page"
},
{
"archivePath": null,
"graphqlSingleName": "mediaItem"
}
]
}
},
"extensions": {}
}
doing gatsby-clean and gatsby develop --verbose, dont see the archive page created, all other yes (post, taxonomy archives etc)
wpgatsby version 2.3.3 wpgraphql version 1.12.0 gatsby-source-wordpress 8.19.1
I've checked more with verbose, i have this warning (wp site set to homepage (page), and page blog:
warn Template "Post" not found at ./src/templates/archive/page for type "Page"
on uri "null"
I will try to reproduce this issue with the same versions you are using. If you are using something like localWP and could provide me with an easy way to reproduce this that would be helpful too.
i have tested the plugins with older versions, it seems that the problem is version of wp graphql, wp-graphql.1.10.0 and above not work, but it work up to wp-graphql.1.9.1. this is working with page Homepage and post Blog, set in setting, but not working as default (post in homepage)
i have tested the plugins with older versions, it seems that the problem is version of wp graphql, wp-graphql.1.10.0 and above not work, but it work up to wp-graphql.1.9.1. this is working with page Homepage and post Blog, set in setting, but not working as default (post in homepage)
Thanks for the additional info. I'll let you know if I find the fix. Feel free to open a PR if you find a fix first!
@CalebBarnes In v1.10.0 WPGraphQL doesn't recognize the Posts
page as a Page
object anymore (since archives are technically content types)
Gatsby is not my cup of tea, so I cant point out what specifically in this codebase needs to change, but hopefully the changelog notes will help you nail it down.
@mosesintech fix in this pr https://github.com/CalebBarnes/gatsby-theme-headless-wordpress/pull/3 has been published to npm in the beta version 0.1.14-beta.-0 https://www.npmjs.com/package/gatsby-theme-headless-wordpress/v/0.1.14-beta.0
@giodc Can you test this new beta version to see if it fixes the issue for you?
@CalebBarnes thanks i have tested it and it work correctly, i only noticed that the blog page is created two times, once as "post" the other as "post archive":
Creating post at /test/ Creating post archive at /test/
(test is the slug of the post archive page)
verbose Creating post at /test/ verbose Creating Page at / verbose Creating Page at /sample-page/ verbose Creating Post at /2022/10/30/hello-world/ verbose Creating Post at /2022/10/29/odio-sit-facere-libero-voluptates-a-aut/ verbose Creating Post at /2022/10/29/ut-neque-adipisci-non-dolores-nihil-nihil/ verbose Creating Post at /2022/10/29/quo-facere-enim-corrupti/ verbose Creating Post at /2022/10/29/repellat-neque-similique-sed-accusamus-labore/ verbose Creating Post at /2022/10/29/consectetur-maiores-sit-numquam-molestiae-similique-sed/ verbose Creating Post at /2022/10/29/possimus-error-est-rerum-et/ verbose Creating Post at /2022/10/29/quia-quam-qui-iure-fugiat/ verbose Creating Post at /2022/10/29/ipsa-at-nulla-illum-cum-ea-eius-perspiciatis/ verbose Creating Post at /2022/10/29/dolore-eaque-beatae-magni-numquam-voluptates/ verbose Creating Post at /2022/10/29/similique-sed-et-omnis-voluptatem/ verbose Creating post archive at /test/ verbose Creating post archive at /test/2 verbose Creating post archive at /test/3
I' m trying to make this work, it work very well, the only issue i have is with the post archive, it do not work, and in console i have this error: warn The GraphQL query in the non-page component "**/src/templates/archive/post.tsx" will not be run.
i have tryed both default wordpress setting, and also set an homepage page, and a blog page for the blog, same results "Gatsby.js development 404 page"
should the blog archive have to be mapped in other way? thanks ;)