플러그인 데이터 쿼리
플러그인 데이터 쿼리SEOPress

SEOPress

SEOPress 플러그인의 데이터를 다루는 쿼리 예시를 소개합니다.

SEO 메타데이터 가져오기

메타 필드를 사용하여 SEO 메타데이터를 쿼리할 수 있습니다:

query GetPost($postId: ID!) {
  post(by: { id: $postId }) {
    id
    title
 
    metaTitle: metaValue(key: "_seopress_titles_title")
    metaDesc: metaValue(key: "_seopress_titles_desc")
    focusKeyword: metaValue(key: "_seopress_analysis_target_kw")
    canonical: metaValue(key: "_seopress_robots_canonical")
    socialFBTitle: metaValue(key: "_seopress_social_fb_title")
    socialFBDesc: metaValue(key: "_seopress_social_fb_desc")
    socialFBImage: metaValue(key: "_seopress_social_fb_img")
    socialTwitterTitle: metaValue(key: "_seopress_social_twitter_title")
    socialTwitterDesc: metaValue(key: "_seopress_social_twitter_desc")
    socialTwitterImage: metaValue(key: "_seopress_social_twitter_img")
  }
}

SEO 메타데이터 업데이트

메타 뮤테이션을 사용하여 SEO 메타데이터를 업데이트할 수 있습니다:

mutation UpdatePost($postId: ID!) {
  updatePost(
    input: {
      id: $postId
      meta: {
        _seopress_titles_title: ["New title"],
        _seopress_titles_desc: ["New description"],
        _seopress_analysis_target_kw: ["New focus keyword"],
        _seopress_robots_canonical: ["https://example.com/canonical-url"],
        _seopress_social_fb_title: ["Social title"],
        _seopress_social_fb_desc: ["Social description"],
        _seopress_social_fb_img: ["https://example.com/social-image.jpg"],
        _seopress_social_twitter_title: ["Social title"],
        _seopress_social_twitter_desc: ["Social description"],
        _seopress_social_twitter_img: ["https://example.com/social-image.jpg"],
      }
    }
  ) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
    post {
      id
      metaTitle: metaValue(key: "_seopress_titles_title")
      metaDesc: metaValue(key: "_seopress_titles_desc")
      focusKeyword: metaValue(key: "_seopress_analysis_target_kw")
      canonical: metaValue(key: "_seopress_robots_canonical")
      socialFBTitle: metaValue(key: "_seopress_social_fb_title")
      socialFBDesc: metaValue(key: "_seopress_social_fb_desc")
      socialFBImage: metaValue(key: "_seopress_social_fb_img")
      socialTwitterTitle: metaValue(key: "_seopress_social_twitter_title")
      socialTwitterDesc: metaValue(key: "_seopress_social_twitter_desc")
      socialTwitterImage: metaValue(key: "_seopress_social_twitter_img")
    }
  }
}