AxeWP / wp-graphql-rank-math

Add GraphQL support for RankMath SEO
GNU General Public License v3.0
50 stars 7 forks source link

Fallback to page URL when canonicalUrl field is null #93

Closed ariel-integrity closed 3 months ago

ariel-integrity commented 4 months ago

What problem does this address?

Pulling canonicalUrl and getting the default value (when not set by WP admin user) sets developer up for simple implementation.

What is your proposed solution?

Fallback to page URL when canonicalUrl field is null, make available in WPGraphQL queries

What alternatives have you considered?

Setting up canonical to be page URL by default within next, have it overridden if the field pulled by WPGraphQL Rank Math plugin is not null.

Additional Context

No response

justlevine commented 4 months ago

Hey @ariel-integrity ,

I'm unable to replicate this. Perhaps you can provide more specific information about your setup + replication steps?


  1. Create a new post or page. (Note how the canonical URL is greyed out, the text there is just the placeholder).

image

  1. Query posts for canonicalUrl
query MyQuery {
  contentNodes {
    nodes {
      ... on Post {
        seo {
          ... on RankMathPostObjectSeo{
            canonicalUrl
          }
        }
      }
    }
  }
}
  1. See results. image
justlevine commented 3 months ago

Hey @ariel-integrity, It's been quiet for a few weeks, so I'm going to assume you've figured this out and close out this ticket.

If you're still experiencing this issue, please respond with some replication steps, and I'll reopen this and take a look.