ashhitch / gatsby-plugin-wpgraphql-seo

Gatsby Plugin to Bring Yoast Seo Data into Gatsby via WpGraphQL.
MIT License
13 stars 8 forks source link

options does not replace #25

Open ghost opened 2 years ago

ghost commented 2 years ago

I would like to replace the URL of my og:image and place it in the Gatsby static folder. Right now, it is loaded (and worse: displayed) with the full URL of my backend, that I'd like to hide.

const options = {
      schemaReplacement: {
              from: 'https://sub.url.com/';
              to: '';
          }
  }

This code does not seem to work and the full URL is displayed. How to fix this?

Screenshot 2022-03-19 at 11 19 37 AM
techexpresslive commented 2 years ago

You need to add localFile query to your opengraphImage in graphql query to resolve this problem.

opr-inzn commented 2 years ago

Hey @techexpresslive thanks for your reply! Where shall I add this in my query:

const {
    wp: { seo },
  } = useStaticQuery(graphql`
    query SiteInfoQuery {
      wp {
        seo {
          contentTypes {
            post {
              title
              schemaType
              metaRobotsNoindex
              metaDesc
            }
            page {
              metaDesc
              metaRobotsNoindex
              schemaType
              title
            }
          }
          webmaster {
            googleVerify
            yandexVerify
            msVerify
            baiduVerify
          }
          schema {
            companyName
            personName
            companyOrPerson
            wordpressSiteName
            siteUrl
            siteName
            inLanguage
            logo {
              sourceUrl
              mediaItemUrl
              altText
            }
          }
          social {
            facebook {
              url
              defaultImage {
                sourceUrl
                mediaItemUrl
              }
            }
            instagram {
              url
            }
            linkedIn {
              url
            }
            mySpace {
              url
            }
            pinterest {
              url
              metaTag
            }
            twitter {
              username
            }
            wikipedia {
              url
            }
            youTube {
              url
            }
          }
        }
      }
    }
  `);