플러그인 데이터 쿼리Rank Math
Rank Math
Rank Math 플러그인의 데이터를 조작하는 queries 예시를 소개합니다.
SEO 메타데이터 가져오기
메타 필드를 사용하여 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")
}
}SEO 메타데이터 업데이트
메타 뮤테이션을 사용하여 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