• Resolved afridley

    (@afridley)


    The plugin works great. However, all of my custom post types are returning nothing. Do I need to configure something to recieve the Yoast settings for these posts

    It looks like it is actually for all posts.
    The plugin works great on pages.

    I’m guessing it is related to
    `
    warn Multiple node fields resolve to the same GraphQL field wordpress__POST.yoast_meta.content – [content, content___NODE]. Gatsby will use content___NODE.
    warn Multiple node fields resolve to the same GraphQL field wordpress__wp_media.yoast_meta.content – [content, content___NODE]. Gatsby will use content___NODE.
    warn Multiple node fields resolve to the same GraphQL field wordpress__wp_insights.yoast_meta.content – [content, content___NODE]. Gatsby will use content___NODE.
    warn Multiple node fields resolve to the same GraphQL field wordpress__wp_work.yoast_meta.content – [content, content___NODE]. Gatsby will use content___NODE.
    `

    I am using Gatsby to pull the data. When I inspect the actual endpoint on the wordpress end I do see the yoast_meta object with the correct description

    • This topic was modified 5 years, 5 months ago by afridley.
    • This topic was modified 5 years, 5 months ago by afridley.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @afridley

    Thank you for using our plugin!

    I am not familiar with Gatsby, so I can not say for sure if it is related to the warnings you are getting. However reading these warnings I must say it sure looks like it is related.

    To be sure the problem you are having is related to our plugin (and not to your Gatsby implementation) could you please check if the Yoast Meta is present in the WP RES API? Visit https://<url-to-your-worpress-installation>/wp-json/wp/v2/posts and see if there are items with the yoast_meta element. Please let us know!

    Thread Starter afridley

    (@afridley)

    Yeah it looks like it was a problem that needed to fixed in Gatsby. I’ll leave the solution here for anyone that runs into this. https://github.com/gatsbyjs/gatsby/issues/18736

    You need to add

    `
    exports.createSchemaCustomization = ({ actions }) => {
    const { createTypes } = actions;
    const typeDefs = `
    type WordPressYoastMeta @dontInfer {
    property: String
    content: String
    name: String
    }

    type wordpress__wp_work implements Node @infer {
    yoast_meta: [WordpressYoastMeta]
    }

    type wordpress__POST implements Node @infer {
    yoast_meta: [WordpressYoastMeta]
    }

    type wordpress__wp_media implements Node @infer {
    yoast_meta: [WordpressYoastMeta]
    }

    type wordpress__wp_insights implements Node @infer {
    yoast_meta: [WordpressYoastMeta]
    }

    `;
    createTypes(typeDefs)
    };
    `

    to gatsby-node.js

    If you get a build error your gatsby dependancy is probably out of date and does not support exports.createSchemaCustomization.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to enable for custom post type’ is closed to new replies.