Consultar datos de plugins
Consultar datos de pluginsThe SEO Framework

The SEO Framework

Ejemplos de consultas para interactuar con datos del plugin The SEO Framework.

Obtener metadatos SEO

Podemos usar Valores meta para consultar los metadatos SEO:

query GetPost($postId: ID!) {
  post(by: { id: $postId }) {
    id
    title
 
    metaTitle: metaValue(key: "_genesis_title")
    metaDesc: metaValue(key: "_genesis_description")
    canonical: metaValue(key: "_genesis_canonical_uri")
    socialTitle: metaValue(key: "_open_graph_title")
    socialDesc: metaValue(key: "_open_graph_description")
    socialImage: metaValue(key: "_social_image_url")
    twitterTitle: metaValue(key: "_twitter_title")
    twitterDesc: metaValue(key: "_twitter_description")
  }
}

Actualizar metadatos SEO

Podemos usar Valores meta para actualizar los metadatos SEO:

mutation UpdatePost($postId: ID!) {
  updatePost(
    input: {
      id: $postId
      meta: {
        _genesis_title: ["New focus keyword"],
        _genesis_description: ["New description"],
        _genesis_canonical_uri: ["https://example.com/canonical-url"],
        _open_graph_title: ["Social title"],
        _open_graph_description: ["Social description"],
        _social_image_url: ["https://example.com/social-image.jpg"],
        _twitter_title: ["New Twitter title"],
        _twitter_description: ["New Twitter description"],
      }
    }
  ) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
    post {
      id
      metaTitle: metaValue(key: "_genesis_title")
      metaDesc: metaValue(key: "_genesis_description")
      canonical: metaValue(key: "_genesis_canonical_uri")
      socialTitle: metaValue(key: "_open_graph_title")
      socialDesc: metaValue(key: "_open_graph_description")
      socialImage: metaValue(key: "_social_image_url")
      twitterTitle: metaValue(key: "_twitter_title")
      twitterDesc: metaValue(key: "_twitter_description")
    }
  }
}