Query Plugin DataSlim SEO
Slim SEO
Examples of queries to interact with data from the Slim SEO plugin.
Fetching SEO metadata
We can use meta fields to query SEO metadata:
query GetPost($postId: ID!) {
post(by: { id: $postId }) {
id
title
slimSeoMeta: metaValue(key: "slim_seo")
metaTitle: _objectProperty(object: $__slimSeoMeta, by: { key: "title" }, failIfNonExistingKeyOrPath: false)
metaDesc: _objectProperty(object: $__slimSeoMeta, by: { key: "description" }, failIfNonExistingKeyOrPath: false)
fbImage: _objectProperty(object: $__slimSeoMeta, by: { key: "facebook_image" }, failIfNonExistingKeyOrPath: false)
twitterImage: _objectProperty(object: $__slimSeoMeta, by: { key: "twitter_image" }, failIfNonExistingKeyOrPath: false)
canonical: _objectProperty(object: $__slimSeoMeta, by: { key: "canonical" }, failIfNonExistingKeyOrPath: false)
}
}
Prev