ashhitch / wp-graphql-yoast-seo
使用wp-graphql查询Yoast SEO数据
v4.22.5
2023-06-30 20:18 UTC
Requires
Requires (Dev)
Suggests
- wp-graphql/wp-graphql: Required to return data via GraphQl
- yoast/wordpress-seo: Required to provide SEO data to this plugin
- dev-master
- v4.22.5
- v4.22.4
- v4.22.3
- v4.22.2
- v4.22.1
- v4.22.0
- v4.21.0
- v4.20.0
- v4.19.0
- v4.18.1
- V4.18.0
- v4.17.0
- v4.16.2
- v4.16.1
- v4.16.0
- v4.15.1
- v4.15.0
- v4.14.2
- v4.14.1
- v4.14.0
- v4.13.1
- v4.13.0
- v4.12.1
- v4.12.0
- v4.11.0
- v4.10.2
- v4.10.1
- v4.10.0
- v4.9.0
- v4.8.0
- v4.7.1
- v4.7.0
- v4.6.0
- v4.5.5
- v4.5.4
- v4.5.3
- v4.5.2
- v4.5.1
- v4.5.0
- v4.4.1
- v4.4.0
- v4.3.0
- v4.2.0
- v4.1.0
- v4.0.1
- v4.0.0Alpha
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- v2.2.0
- v2.1.0
- dev-hotfix/meta-error
- dev-dependabot/npm_and_yarn/yaml-2.2.2
- dev-feature/socialProfiles
- dev-feature/code-tidy
- dev-feature/bug-scrub-jan-22
- dev-ashhitch-patch-1
- dev-feature/author-archives
- dev-feature/more-author-data
- dev-hotfix/tax-canonical
- dev-feature/yoast-16.7
- dev-feature/entity_decode
- dev-hotfix/undefined-indexes
- dev-feature/archive-meta
- dev-feature/reading-time
- dev-feature/schemaInPostTypeSettings
- dev-feature/full-schema-v2
- dev-feature/schema-v3
- dev-hotfix/opengraph-image-urls
- dev-feature/full-schema
- dev-phpcs
- dev-feature/update-examples
- dev-feature/content-types
- dev-hotfix/categories
- dev-feature/primary-category
- dev-feature/schema-fields
- dev-feature/open-graph
- dev-hotfix/site-schema
This package is auto-updated.
Last update: 2024-09-07 09:15:22 UTC
README
请注意,Yoast插件的第14版是一个重大更新。
如果你卡在Yoast V14之前的版本,请使用此插件的v3。
这是WPGraphQL插件(https://github.com/wp-graphql/wp-graphql)的一个扩展,它返回Yoast SEO数据。
使用此插件吗?我很想看到你用它做了什么。😃 @ash_hitchcock
当前返回以下SEO数据
- 页面
- 文章
- 自定义文章类型
- 产品(WooCommerce)
- 分类
- 自定义分类法
- WooCommerce产品
- Yoast配置
- 网站管理员验证
- 社交档案
- 方案
- 面包屑
如果有任何Yoast数据目前没有返回,请提出一个问题,以便我们可以将其添加到路线图。
快速安装
- 从WordPress插件目录安装
- 将此存储库的zip文件克隆或下载到您的WordPress插件目录中,并激活“WP GraphQL Yoast SEO”插件
- 安装并激活WPGraphQL
Composer
composer require ashhitch/wp-graphql-yoast-seo
觉得这个有用吗?
规范
请注意,如果您在WordPress设置中将“阻止搜索引擎”选项打开,则规范将不会返回。
V4重大更改
插件现在至少需要Yoast 14.0.0
V3重大更改
图片URL现在返回为mediaItem
类型。
这适用于twitterImage
和opengraphImage
与Gatsby一起使用
查看配套的Gatsby插件,轻松添加元数据和JSON LD方案。
用法
要查询Yoast数据,只需将seo对象添加到您的查询中
文章类型数据
query GetPages { pages(first: 10) { edges { node { id title seo { canonical title metaDesc focuskw metaRobotsNoindex metaRobotsNofollow opengraphAuthor opengraphDescription opengraphTitle opengraphDescription opengraphImage { altText sourceUrl srcSet } opengraphUrl opengraphSiteName opengraphPublishedTime opengraphModifiedTime twitterTitle twitterDescription twitterImage { altText sourceUrl srcSet } breadcrumbs { url text } cornerstone schema { pageType articleType raw } readingTime fullHead } author { node { seo { metaDesc metaRobotsNofollow metaRobotsNoindex title social { youTube wikipedia twitter soundCloud pinterest mySpace linkedIn instagram facebook } } } } } } } }
文章分类法数据
query GetCategories { categories(first: 10) { edges { node { id seo { fullHead canonical title metaDesc focuskw metaRobotsNoindex metaRobotsNofollow opengraphAuthor opengraphDescription opengraphTitle opengraphDescription opengraphImage { altText sourceUrl srcSet } twitterTitle twitterDescription twitterImage { altText sourceUrl srcSet } breadcrumbs { url text } } name } } } }
用户数据
query GetUsers { users { nodes { seo { metaDesc metaRobotsNofollow metaRobotsNoindex title fullHead social { youTube wikipedia twitter soundCloud pinterest mySpace linkedIn instagram facebook } } } } }
边缘和页面信息数据
query GetPostsWithIsPrimary { posts { pageInfo { startCursor seo { schema { raw } } } nodes { title slug categories { edges { isPrimary node { name count } } } } } }
Yoast配置数据
query GetSeoConfig { seo { meta { author { description title } date { description title } config { separator } homepage { description title } notFound { breadcrumb title } } webmaster { googleVerify yandexVerify msVerify baiduVerify } schema { siteName wordpressSiteName siteUrl inLanguage companyName companyOrPerson companyLogo { mediaItemUrl } logo { mediaItemUrl } personLogo { mediaItemUrl } } breadcrumbs { showBlogPage separator searchPrefix prefix homeText enabled boldLast archivePrefix notFoundText } social { facebook { url defaultImage { mediaItemUrl } } instagram { url } linkedIn { url } mySpace { url } pinterest { url metaTag } twitter { cardType username } wikipedia { url } youTube { url } otherSocials } openGraph { frontPage { title description image { altText sourceUrl mediaItemUrl } } defaultImage { altText sourceUrl mediaItemUrl } } contentTypes { post { title schemaType metaRobotsNoindex metaDesc schema { raw } archive { fullHead archiveLink breadcrumbTitle hasArchive metaDesc metaRobotsNoindex title } } page { metaDesc metaRobotsNoindex schemaType title schema { raw } } } redirects { origin target format type } } }
contentNode和nodeByUri
contentNode(id: "1", idType: DATABASE_ID) { id contentTypeName seo { title metaDesc } } node(id: "cG9zdDox",) { ... on NodeWithTitle { seo { title metaDesc } } } nodeByUri(uri: "/") { ... on NodeWithTitle { seo { title metaDesc } } }
支持
请注意:Yoast、WPGraphQL及其标志均为其各自所有者的版权。