Changeset 2376996
- Timestamp:
- 09/08/2020 07:36:56 AM (6 years ago)
- Location:
- add-wpgraphql-seo
- Files:
-
- 8 edited
- 1 copied
-
tags/4.6.0 (copied) (copied from add-wpgraphql-seo/trunk)
-
tags/4.6.0/CHANGELOG.md (modified) (1 diff)
-
tags/4.6.0/README.md (modified) (1 diff)
-
tags/4.6.0/readme.txt (modified) (2 diffs)
-
tags/4.6.0/wp-graphql-yoast-seo.php (modified) (11 diffs)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/README.md (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-graphql-yoast-seo.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
add-wpgraphql-seo/tags/4.6.0/CHANGELOG.md
r2365465 r2376996 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [4.6.0] - 2020-09-08 9 10 ### Added 11 12 - New Schema fields: 13 - pageType 14 - articleType 15 - Added cornerstone flag 16 17 ### Changed 18 19 - Changed Type used on Post Types and Taxonomies from `SEO` to `PostTypeSEO` and `TaxonomySEO` 7 20 8 21 ## [4.5.5] - 2020-08-20 -
add-wpgraphql-seo/tags/4.6.0/README.md
r2365465 r2376996 96 96 text 97 97 } 98 cornerstone 99 schema { 100 pageType 101 articleType 102 } 98 103 } 99 104 100 105 author { 101 seo { 102 metaDesc 103 metaRobotsNofollow 104 metaRobotsNoindex 105 title 106 social { 107 youTube 108 wikipedia 109 twitter 110 soundCloud 111 pinterest 112 mySpace 113 linkedIn 114 instagram 115 facebook 106 node { 107 seo { 108 metaDesc 109 metaRobotsNofollow 110 metaRobotsNoindex 111 title 112 social { 113 youTube 114 wikipedia 115 twitter 116 soundCloud 117 pinterest 118 mySpace 119 linkedIn 120 instagram 121 facebook 122 } 116 123 } 117 124 } -
add-wpgraphql-seo/tags/4.6.0/readme.txt
r2365465 r2376996 5 5 Tested up to: 5.4 6 6 Requires PHP: 7.1 7 Stable tag: 4. 5.47 Stable tag: 4.6.0 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 40 40 2. Upload plugin to the `/wp-content/plugins/` directory 41 41 42 To query for the Yoast Data simply add the seo object to your query:43 42 44 ` 45 { 46 pages(first: 10) { 47 edges { 48 node { 49 id 50 title 51 seo { 52 canonical 53 title 54 metaDesc 55 focuskw 56 metaRobotsNoindex 57 metaRobotsNofollow 58 opengraphAuthor 59 opengraphDescription 60 opengraphTitle 61 opengraphDescription 62 opengraphImage { 63 altText 64 sourceUrl 65 srcSet 66 } 67 opengraphUrl 68 opengraphSiteName 69 opengraphPublishedTime 70 opengraphModifiedTime 71 twitterTitle 72 twitterDescription 73 twitterImage { 74 altText 75 sourceUrl 76 srcSet 77 } 78 breadcrumbs { 79 url 80 text 81 } 82 } 83 84 author { 85 seo { 86 metaDesc 87 metaRobotsNofollow 88 metaRobotsNoindex 89 title 90 social { 91 youTube 92 wikipedia 93 twitter 94 soundCloud 95 pinterest 96 mySpace 97 linkedIn 98 instagram 99 facebook 100 } 101 } 102 } 103 } 104 } 105 } 106 107 categories(first: 10) { 108 edges { 109 node { 110 id 111 seo { 112 canonical 113 title 114 metaDesc 115 focuskw 116 metaRobotsNoindex 117 metaRobotsNofollow 118 opengraphAuthor 119 opengraphDescription 120 opengraphTitle 121 opengraphDescription 122 opengraphImage { 123 altText 124 sourceUrl 125 srcSet 126 } 127 twitterTitle 128 twitterDescription 129 twitterImage { 130 altText 131 sourceUrl 132 srcSet 133 } 134 breadcrumbs { 135 url 136 text 137 } 138 } 139 name 140 } 141 } 142 } 143 144 users { 145 nodes { 146 seo { 147 metaDesc 148 metaRobotsNofollow 149 metaRobotsNoindex 150 title 151 social { 152 youTube 153 wikipedia 154 twitter 155 soundCloud 156 pinterest 157 mySpace 158 linkedIn 159 instagram 160 facebook 161 } 162 } 163 } 164 } 165 } 166 ` 167 168 To query for the site configuration data you can query from the root. 169 170 ` 171 { 172 posts { 173 174 } 175 176 seo { 177 webmaster { 178 googleVerify 179 yandexVerify 180 msVerify 181 baiduVerify 182 } 183 schema { 184 siteName 185 wordpressSiteName 186 siteUrl 187 companyName 188 companyOrPerson 189 companyLogo { 190 mediaItemUrl 191 } 192 logo { 193 mediaItemUrl 194 } 195 personLogo { 196 mediaItemUrl 197 } 198 } 199 breadcrumbs { 200 showBlogPage 201 separator 202 searchPrefix 203 prefix 204 homeText 205 enabled 206 boldLast 207 archivePrefix 208 notFoundText 209 } 210 social { 211 facebook { 212 url 213 defaultImage { 214 mediaItemUrl 215 } 216 } 217 instagram { 218 url 219 } 220 linkedIn { 221 url 222 } 223 mySpace { 224 url 225 } 226 pinterest { 227 url 228 metaTag 229 } 230 twitter { 231 cardType 232 username 233 } 234 wikipedia { 235 url 236 } 237 youTube { 238 url 239 } 240 } 241 openGraph { 242 frontPage { 243 title 244 description 245 image { 246 altText 247 sourceUrl 248 mediaItemUrl 249 } 250 } 251 defaultImage { 252 altText 253 sourceUrl 254 mediaItemUrl 255 } 256 } 257 # Redirects only work in the premium version of Yoast 258 redirects { 259 origin 260 target 261 format 262 type 263 } 264 } 265 } 266 ` 43 [See GitHub Repo for example queries](https://github.com/ashhitch/wp-graphql-yoast-seo) 267 44 268 45 == Upgrade Notice == -
add-wpgraphql-seo/tags/4.6.0/wp-graphql-yoast-seo.php
r2365465 r2376996 9 9 * Text Domain: wp-graphql-yoast-seo 10 10 * Domain Path: /languages 11 * Version: 4. 5.511 * Version: 4.6.0 12 12 * 13 13 * @package WP_Graphql_YOAST_SEO … … 101 101 ]); 102 102 103 register_graphql_object_type('SEO', [ 104 'fields' => [ 105 'title' => ['type' => 'String'], 106 'metaDesc' => ['type' => 'String'], 107 'focuskw' => ['type' => 'String'], 108 'metaKeywords' => ['type' => 'String'], 109 'metaRobotsNoindex' => ['type' => 'String'], 110 'metaRobotsNofollow' => ['type' => 'String'], 111 'opengraphTitle' => ['type' => 'String'], 112 'opengraphUrl' => ['type' => 'String'], 113 'opengraphSiteName' => ['type' => 'String'], 114 'opengraphType' => ['type' => 'String'], 115 'opengraphAuthor' => ['type' => 'String'], 116 'opengraphPublisher' => ['type' => 'String'], 117 'opengraphPublishedTime' => ['type' => 'String'], 118 'opengraphModifiedTime' => ['type' => 'String'], 119 'opengraphDescription' => ['type' => 'String'], 120 'opengraphImage' => ['type' => 'MediaItem'], 121 'twitterTitle' => ['type' => 'String'], 122 'twitterDescription' => ['type' => 'String'], 123 'twitterImage' => ['type' => 'MediaItem'], 124 'canonical' => ['type' => 'String'], 125 'breadcrumbs' => ['type' => ['list_of' => 'SEOPostTypeBreadcrumbs']], 126 ] 127 ]); 103 register_graphql_object_type('SEOPostTypeSchema', [ 104 'description' => __('The Schema types', 'wp-graphql-yoast-seo'), 105 'fields' => [ 106 'pageType' => ['type' => ['list_of' => 'String']], 107 'articleType' => ['type' => ['list_of' => 'String']], 108 ] 109 ]); 110 111 $baseSEOFields = array( 112 'title' => ['type' => 'String'], 113 'metaDesc' => ['type' => 'String'], 114 'focuskw' => ['type' => 'String'], 115 'metaKeywords' => ['type' => 'String'], 116 'metaRobotsNoindex' => ['type' => 'String'], 117 'metaRobotsNofollow' => ['type' => 'String'], 118 'opengraphTitle' => ['type' => 'String'], 119 'opengraphUrl' => ['type' => 'String'], 120 'opengraphSiteName' => ['type' => 'String'], 121 'opengraphType' => ['type' => 'String'], 122 'opengraphAuthor' => ['type' => 'String'], 123 'opengraphPublisher' => ['type' => 'String'], 124 'opengraphPublishedTime' => ['type' => 'String'], 125 'opengraphModifiedTime' => ['type' => 'String'], 126 'opengraphDescription' => ['type' => 'String'], 127 'opengraphImage' => ['type' => 'MediaItem'], 128 'twitterTitle' => ['type' => 'String'], 129 'twitterDescription' => ['type' => 'String'], 130 'twitterImage' => ['type' => 'MediaItem'], 131 'canonical' => ['type' => 'String'], 132 'breadcrumbs' => ['type' => ['list_of' => 'SEOPostTypeBreadcrumbs']], 133 'cornerstone' => ['type' => 'Boolean'], 134 ); 135 136 register_graphql_object_type('TaxonomySEO', [ 137 'fields' => $baseSEOFields 138 ]); 139 140 register_graphql_object_type('PostTypeSEO', [ 141 'fields' => array_merge($baseSEOFields, array('schema' => ['type' => 'SEOPostTypeSchema'])), 142 ]); 143 128 144 129 145 register_graphql_object_type('SEOPostTypeBreadcrumbs', [ … … 134 150 ] 135 151 ]); 152 136 153 137 154 register_graphql_object_type('SEOSchema', [ … … 139 156 'fields' => [ 140 157 'companyName' => ['type' => 'String'], 158 'personName' => ['type' => 'String'], 141 159 'companyOrPerson' => ['type' => 'String'], 142 160 'companyLogo' => ['type' => 'MediaItem'], … … 314 332 $redirects = $redirectsObj ? $redirectsObj->get_from_option() : []; 315 333 334 $userID = $all['company_or_person_user_id']; 335 $user = get_userdata($userID); 316 336 317 337 $mappedRedirects = function ($value) { … … 365 385 'schema' => array( 366 386 'companyName' => wp_gql_seo_format_string($all['company_name']), 387 'personName' => wp_gql_seo_format_string($user->user_nicename), 367 388 'companyLogo' => DataSource::resolve_post_object($all['company_logo_id'], $context), 368 389 'personLogo' => DataSource::resolve_post_object($all['person_logo_id'], $context), … … 393 414 if (isset($post_type_object->graphql_single_name)) : 394 415 register_graphql_field($post_type_object->graphql_single_name, 'seo', [ 395 'type' => ' SEO',416 'type' => 'PostTypeSEO', 396 417 'description' => __('The Yoast SEO data of the ' . $post_type_object->graphql_single_name, 'wp-graphql-yoast-seo'), 397 418 'resolve' => function ($post, array $args, AppContext $context) { … … 402 423 // https://developer.yoast.com/blog/yoast-seo-14-0-using-yoast-seo-surfaces/ 403 424 $robots = YoastSEO()->meta->for_post($post->ID)->robots; 425 404 426 // Get data 405 427 $seo = array( … … 425 447 'twitterImage' => DataSource::resolve_post_object(attachment_url_to_postid(YoastSEO()->meta->for_post($post->ID)->twitter_image), $context), 426 448 'canonical' => wp_gql_seo_format_string(YoastSEO()->meta->for_post($post->ID)->canonical), 427 'breadcrumbs' => YoastSEO()->meta->for_post($post->ID)->breadcrumbs 449 'breadcrumbs' => YoastSEO()->meta->for_post($post->ID)->breadcrumbs, 450 'cornerstone' => boolval(YoastSEO()->meta->for_post($post->ID)->indexable->is_cornerstone), 451 'schema' => array( 452 'pageType' => is_array(YoastSEO()->meta->for_post($post->ID)->schema_page_type) ? YoastSEO()->meta->for_post($post->ID)->schema_page_type : [], 453 'articleType' => is_array(YoastSEO()->meta->for_post($post->ID)->schema_article_type) ? YoastSEO()->meta->for_post($post->ID)->schema_article_type : [], 454 ), 428 455 ); 456 429 457 430 458 return !empty($seo) ? $seo : null; … … 476 504 477 505 register_graphql_field($taxonomy->graphql_single_name, 'seo', [ 478 'type' => ' SEO',506 'type' => 'TaxonomySEO', 479 507 'description' => __('The Yoast SEO data of the ' . $taxonomy->label . ' taxonomy.', 'wp-graphql-yoast-seo'), 480 508 'resolve' => function ($term, array $args, AppContext $context) { … … 508 536 'twitterImage' => DataSource::resolve_post_object($meta['wpseo_twitter-image-id'], $context), 509 537 'canonical' => wp_gql_seo_format_string($meta['canonical']), 510 'breadcrumbs' => YoastSEO()->meta->for_term($term->term_id)->breadcrumbs 538 'breadcrumbs' => YoastSEO()->meta->for_term($term->term_id)->breadcrumbs, 539 'cornerstone' => boolval(YoastSEO()->meta->for_term($term->term_id)->is_cornerstone), 511 540 ); 512 541 wp_reset_query(); -
add-wpgraphql-seo/trunk/CHANGELOG.md
r2365465 r2376996 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [4.6.0] - 2020-09-08 9 10 ### Added 11 12 - New Schema fields: 13 - pageType 14 - articleType 15 - Added cornerstone flag 16 17 ### Changed 18 19 - Changed Type used on Post Types and Taxonomies from `SEO` to `PostTypeSEO` and `TaxonomySEO` 7 20 8 21 ## [4.5.5] - 2020-08-20 -
add-wpgraphql-seo/trunk/README.md
r2365465 r2376996 96 96 text 97 97 } 98 cornerstone 99 schema { 100 pageType 101 articleType 102 } 98 103 } 99 104 100 105 author { 101 seo { 102 metaDesc 103 metaRobotsNofollow 104 metaRobotsNoindex 105 title 106 social { 107 youTube 108 wikipedia 109 twitter 110 soundCloud 111 pinterest 112 mySpace 113 linkedIn 114 instagram 115 facebook 106 node { 107 seo { 108 metaDesc 109 metaRobotsNofollow 110 metaRobotsNoindex 111 title 112 social { 113 youTube 114 wikipedia 115 twitter 116 soundCloud 117 pinterest 118 mySpace 119 linkedIn 120 instagram 121 facebook 122 } 116 123 } 117 124 } -
add-wpgraphql-seo/trunk/readme.txt
r2365465 r2376996 5 5 Tested up to: 5.4 6 6 Requires PHP: 7.1 7 Stable tag: 4. 5.47 Stable tag: 4.6.0 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 40 40 2. Upload plugin to the `/wp-content/plugins/` directory 41 41 42 To query for the Yoast Data simply add the seo object to your query:43 42 44 ` 45 { 46 pages(first: 10) { 47 edges { 48 node { 49 id 50 title 51 seo { 52 canonical 53 title 54 metaDesc 55 focuskw 56 metaRobotsNoindex 57 metaRobotsNofollow 58 opengraphAuthor 59 opengraphDescription 60 opengraphTitle 61 opengraphDescription 62 opengraphImage { 63 altText 64 sourceUrl 65 srcSet 66 } 67 opengraphUrl 68 opengraphSiteName 69 opengraphPublishedTime 70 opengraphModifiedTime 71 twitterTitle 72 twitterDescription 73 twitterImage { 74 altText 75 sourceUrl 76 srcSet 77 } 78 breadcrumbs { 79 url 80 text 81 } 82 } 83 84 author { 85 seo { 86 metaDesc 87 metaRobotsNofollow 88 metaRobotsNoindex 89 title 90 social { 91 youTube 92 wikipedia 93 twitter 94 soundCloud 95 pinterest 96 mySpace 97 linkedIn 98 instagram 99 facebook 100 } 101 } 102 } 103 } 104 } 105 } 106 107 categories(first: 10) { 108 edges { 109 node { 110 id 111 seo { 112 canonical 113 title 114 metaDesc 115 focuskw 116 metaRobotsNoindex 117 metaRobotsNofollow 118 opengraphAuthor 119 opengraphDescription 120 opengraphTitle 121 opengraphDescription 122 opengraphImage { 123 altText 124 sourceUrl 125 srcSet 126 } 127 twitterTitle 128 twitterDescription 129 twitterImage { 130 altText 131 sourceUrl 132 srcSet 133 } 134 breadcrumbs { 135 url 136 text 137 } 138 } 139 name 140 } 141 } 142 } 143 144 users { 145 nodes { 146 seo { 147 metaDesc 148 metaRobotsNofollow 149 metaRobotsNoindex 150 title 151 social { 152 youTube 153 wikipedia 154 twitter 155 soundCloud 156 pinterest 157 mySpace 158 linkedIn 159 instagram 160 facebook 161 } 162 } 163 } 164 } 165 } 166 ` 167 168 To query for the site configuration data you can query from the root. 169 170 ` 171 { 172 posts { 173 174 } 175 176 seo { 177 webmaster { 178 googleVerify 179 yandexVerify 180 msVerify 181 baiduVerify 182 } 183 schema { 184 siteName 185 wordpressSiteName 186 siteUrl 187 companyName 188 companyOrPerson 189 companyLogo { 190 mediaItemUrl 191 } 192 logo { 193 mediaItemUrl 194 } 195 personLogo { 196 mediaItemUrl 197 } 198 } 199 breadcrumbs { 200 showBlogPage 201 separator 202 searchPrefix 203 prefix 204 homeText 205 enabled 206 boldLast 207 archivePrefix 208 notFoundText 209 } 210 social { 211 facebook { 212 url 213 defaultImage { 214 mediaItemUrl 215 } 216 } 217 instagram { 218 url 219 } 220 linkedIn { 221 url 222 } 223 mySpace { 224 url 225 } 226 pinterest { 227 url 228 metaTag 229 } 230 twitter { 231 cardType 232 username 233 } 234 wikipedia { 235 url 236 } 237 youTube { 238 url 239 } 240 } 241 openGraph { 242 frontPage { 243 title 244 description 245 image { 246 altText 247 sourceUrl 248 mediaItemUrl 249 } 250 } 251 defaultImage { 252 altText 253 sourceUrl 254 mediaItemUrl 255 } 256 } 257 # Redirects only work in the premium version of Yoast 258 redirects { 259 origin 260 target 261 format 262 type 263 } 264 } 265 } 266 ` 43 [See GitHub Repo for example queries](https://github.com/ashhitch/wp-graphql-yoast-seo) 267 44 268 45 == Upgrade Notice == -
add-wpgraphql-seo/trunk/wp-graphql-yoast-seo.php
r2365465 r2376996 9 9 * Text Domain: wp-graphql-yoast-seo 10 10 * Domain Path: /languages 11 * Version: 4. 5.511 * Version: 4.6.0 12 12 * 13 13 * @package WP_Graphql_YOAST_SEO … … 101 101 ]); 102 102 103 register_graphql_object_type('SEO', [ 104 'fields' => [ 105 'title' => ['type' => 'String'], 106 'metaDesc' => ['type' => 'String'], 107 'focuskw' => ['type' => 'String'], 108 'metaKeywords' => ['type' => 'String'], 109 'metaRobotsNoindex' => ['type' => 'String'], 110 'metaRobotsNofollow' => ['type' => 'String'], 111 'opengraphTitle' => ['type' => 'String'], 112 'opengraphUrl' => ['type' => 'String'], 113 'opengraphSiteName' => ['type' => 'String'], 114 'opengraphType' => ['type' => 'String'], 115 'opengraphAuthor' => ['type' => 'String'], 116 'opengraphPublisher' => ['type' => 'String'], 117 'opengraphPublishedTime' => ['type' => 'String'], 118 'opengraphModifiedTime' => ['type' => 'String'], 119 'opengraphDescription' => ['type' => 'String'], 120 'opengraphImage' => ['type' => 'MediaItem'], 121 'twitterTitle' => ['type' => 'String'], 122 'twitterDescription' => ['type' => 'String'], 123 'twitterImage' => ['type' => 'MediaItem'], 124 'canonical' => ['type' => 'String'], 125 'breadcrumbs' => ['type' => ['list_of' => 'SEOPostTypeBreadcrumbs']], 126 ] 127 ]); 103 register_graphql_object_type('SEOPostTypeSchema', [ 104 'description' => __('The Schema types', 'wp-graphql-yoast-seo'), 105 'fields' => [ 106 'pageType' => ['type' => ['list_of' => 'String']], 107 'articleType' => ['type' => ['list_of' => 'String']], 108 ] 109 ]); 110 111 $baseSEOFields = array( 112 'title' => ['type' => 'String'], 113 'metaDesc' => ['type' => 'String'], 114 'focuskw' => ['type' => 'String'], 115 'metaKeywords' => ['type' => 'String'], 116 'metaRobotsNoindex' => ['type' => 'String'], 117 'metaRobotsNofollow' => ['type' => 'String'], 118 'opengraphTitle' => ['type' => 'String'], 119 'opengraphUrl' => ['type' => 'String'], 120 'opengraphSiteName' => ['type' => 'String'], 121 'opengraphType' => ['type' => 'String'], 122 'opengraphAuthor' => ['type' => 'String'], 123 'opengraphPublisher' => ['type' => 'String'], 124 'opengraphPublishedTime' => ['type' => 'String'], 125 'opengraphModifiedTime' => ['type' => 'String'], 126 'opengraphDescription' => ['type' => 'String'], 127 'opengraphImage' => ['type' => 'MediaItem'], 128 'twitterTitle' => ['type' => 'String'], 129 'twitterDescription' => ['type' => 'String'], 130 'twitterImage' => ['type' => 'MediaItem'], 131 'canonical' => ['type' => 'String'], 132 'breadcrumbs' => ['type' => ['list_of' => 'SEOPostTypeBreadcrumbs']], 133 'cornerstone' => ['type' => 'Boolean'], 134 ); 135 136 register_graphql_object_type('TaxonomySEO', [ 137 'fields' => $baseSEOFields 138 ]); 139 140 register_graphql_object_type('PostTypeSEO', [ 141 'fields' => array_merge($baseSEOFields, array('schema' => ['type' => 'SEOPostTypeSchema'])), 142 ]); 143 128 144 129 145 register_graphql_object_type('SEOPostTypeBreadcrumbs', [ … … 134 150 ] 135 151 ]); 152 136 153 137 154 register_graphql_object_type('SEOSchema', [ … … 139 156 'fields' => [ 140 157 'companyName' => ['type' => 'String'], 158 'personName' => ['type' => 'String'], 141 159 'companyOrPerson' => ['type' => 'String'], 142 160 'companyLogo' => ['type' => 'MediaItem'], … … 314 332 $redirects = $redirectsObj ? $redirectsObj->get_from_option() : []; 315 333 334 $userID = $all['company_or_person_user_id']; 335 $user = get_userdata($userID); 316 336 317 337 $mappedRedirects = function ($value) { … … 365 385 'schema' => array( 366 386 'companyName' => wp_gql_seo_format_string($all['company_name']), 387 'personName' => wp_gql_seo_format_string($user->user_nicename), 367 388 'companyLogo' => DataSource::resolve_post_object($all['company_logo_id'], $context), 368 389 'personLogo' => DataSource::resolve_post_object($all['person_logo_id'], $context), … … 393 414 if (isset($post_type_object->graphql_single_name)) : 394 415 register_graphql_field($post_type_object->graphql_single_name, 'seo', [ 395 'type' => ' SEO',416 'type' => 'PostTypeSEO', 396 417 'description' => __('The Yoast SEO data of the ' . $post_type_object->graphql_single_name, 'wp-graphql-yoast-seo'), 397 418 'resolve' => function ($post, array $args, AppContext $context) { … … 402 423 // https://developer.yoast.com/blog/yoast-seo-14-0-using-yoast-seo-surfaces/ 403 424 $robots = YoastSEO()->meta->for_post($post->ID)->robots; 425 404 426 // Get data 405 427 $seo = array( … … 425 447 'twitterImage' => DataSource::resolve_post_object(attachment_url_to_postid(YoastSEO()->meta->for_post($post->ID)->twitter_image), $context), 426 448 'canonical' => wp_gql_seo_format_string(YoastSEO()->meta->for_post($post->ID)->canonical), 427 'breadcrumbs' => YoastSEO()->meta->for_post($post->ID)->breadcrumbs 449 'breadcrumbs' => YoastSEO()->meta->for_post($post->ID)->breadcrumbs, 450 'cornerstone' => boolval(YoastSEO()->meta->for_post($post->ID)->indexable->is_cornerstone), 451 'schema' => array( 452 'pageType' => is_array(YoastSEO()->meta->for_post($post->ID)->schema_page_type) ? YoastSEO()->meta->for_post($post->ID)->schema_page_type : [], 453 'articleType' => is_array(YoastSEO()->meta->for_post($post->ID)->schema_article_type) ? YoastSEO()->meta->for_post($post->ID)->schema_article_type : [], 454 ), 428 455 ); 456 429 457 430 458 return !empty($seo) ? $seo : null; … … 476 504 477 505 register_graphql_field($taxonomy->graphql_single_name, 'seo', [ 478 'type' => ' SEO',506 'type' => 'TaxonomySEO', 479 507 'description' => __('The Yoast SEO data of the ' . $taxonomy->label . ' taxonomy.', 'wp-graphql-yoast-seo'), 480 508 'resolve' => function ($term, array $args, AppContext $context) { … … 508 536 'twitterImage' => DataSource::resolve_post_object($meta['wpseo_twitter-image-id'], $context), 509 537 'canonical' => wp_gql_seo_format_string($meta['canonical']), 510 'breadcrumbs' => YoastSEO()->meta->for_term($term->term_id)->breadcrumbs 538 'breadcrumbs' => YoastSEO()->meta->for_term($term->term_id)->breadcrumbs, 539 'cornerstone' => boolval(YoastSEO()->meta->for_term($term->term_id)->is_cornerstone), 511 540 ); 512 541 wp_reset_query();
Note: See TracChangeset
for help on using the changeset viewer.