Consultar Dados de PluginsRank Math
Rank Math
Exemplos de queries para interagir com os dados do plugin Rank Math.
Buscando metadados SEO
Podemos usar os campos meta para consultar metadados SEO:
query GetPost($postId: ID!) {
post(by: { id: $postId }) {
id
title
metaDesc: metaValue(key: "rank_math_description")
focusKeyword: metaValue(key: "rank_math_focus_keyword")
canonical: metaValue(key: "rank_math_canonical_url")
socialTitle: metaValue(key: "rank_math_facebook_title")
socialDesc: metaValue(key: "rank_math_facebook_description")
socialImage: metaValue(key: "rank_math_facebook_image")
twitterTitle: metaValue(key: "rank_math_twitter_title")
twitterDesc: metaValue(key: "rank_math_twitter_description")
twitterImage: metaValue(key: "rank_math_twitter_image")
}
}Atualizando metadados SEO
Podemos usar as mutations meta para atualizar metadados SEO:
mutation UpdatePost($postId: ID!) {
updatePost(
input: {
id: $postId
meta: {
rank_math_description: ["New description"],
rank_math_focus_keyword: ["New focus keyword"],
rank_math_canonical_url: ["https://example.com/canonical-url"],
rank_math_facebook_title: ["Social title"],
rank_math_facebook_description: ["Social description"],
rank_math_facebook_image: ["https://example.com/social-image.jpg"],
rank_math_twitter_title: ["Twitter title"],
rank_math_twitter_description: ["Twitter description"],
rank_math_twitter_image: ["https://example.com/twitter-image.jpg"],
}
}
) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
post {
id
metaDesc: metaValue(key: "rank_math_description")
focusKeyword: metaValue(key: "rank_math_focus_keyword")
canonical: metaValue(key: "rank_math_canonical_url")
socialTitle: metaValue(key: "rank_math_facebook_title")
socialDesc: metaValue(key: "rank_math_facebook_description")
socialImage: metaValue(key: "rank_math_facebook_image")
twitterTitle: metaValue(key: "rank_math_twitter_title")
twitterDesc: metaValue(key: "rank_math_twitter_description")
twitterImage: metaValue(key: "rank_math_twitter_image")
}
}
}Prev
Next