Changeset 3209864
- Timestamp:
- 12/18/2024 12:30:01 PM (16 months ago)
- Location:
- add-wpgraphql-seo
- Files:
-
- 8 edited
- 1 copied
-
tags/4.23.1 (copied) (copied from add-wpgraphql-seo/trunk)
-
tags/4.23.1/CHANGELOG.md (modified) (1 diff)
-
tags/4.23.1/package.json (modified) (1 diff)
-
tags/4.23.1/readme.txt (modified) (1 diff)
-
tags/4.23.1/wp-graphql-yoast-seo.php (modified) (11 diffs)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/package.json (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/wp-graphql-yoast-seo.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
add-wpgraphql-seo/tags/4.23.1/CHANGELOG.md
r2932770 r3209864 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.23.0] - 2024-12-17 9 10 ### Added 11 - Taxonomies archive configuration 7 12 8 13 ## [4.22.5] - 2023-06-30 -
add-wpgraphql-seo/tags/4.23.1/package.json
r2932770 r3209864 1 1 { 2 "name": "wp-graphql-yoast-seo",3 "version": "4.22.5",4 "description": "A WPGraphQL Extension that adds support for Yoast SEO",5 "scripts": {6 "test": "echo \"Error: no test specified\" && exit 1",7 "prettier": "prettier wp-graphql-yoast-seo.php --write",8 "prepare": "husky install"9 },10 "repository": {11 "type": "git",12 "url": "git+https://github.com/ashhitch/wp-graphql-yoast-seo.git"13 },14 "author": "Ash Hitchcock",15 "bugs": {16 "url": "https://github.com/ashhitch/wp-graphql-yoast-seo/issues"17 },18 "homepage": "https://github.com/ashhitch/wp-graphql-yoast-seo#readme",19 "devDependencies": {20 "@prettier/plugin-php": "^0.18.7",21 "husky": ">=8.0.1",22 "lint-staged": ">=13.0.1",23 "prettier": "^2.6.2"24 }2 "name": "wp-graphql-yoast-seo", 3 "version": "v4.23.1", 4 "description": "A WPGraphQL Extension that adds support for Yoast SEO", 5 "scripts": { 6 "test": "echo \"Error: no test specified\" && exit 1", 7 "prettier": "prettier wp-graphql-yoast-seo.php --write", 8 "prepare": "husky install" 9 }, 10 "repository": { 11 "type": "git", 12 "url": "git+https://github.com/ashhitch/wp-graphql-yoast-seo.git" 13 }, 14 "author": "Ash Hitchcock", 15 "bugs": { 16 "url": "https://github.com/ashhitch/wp-graphql-yoast-seo/issues" 17 }, 18 "homepage": "https://github.com/ashhitch/wp-graphql-yoast-seo#readme", 19 "devDependencies": { 20 "@prettier/plugin-php": "^0.18.7", 21 "husky": ">=8.0.1", 22 "lint-staged": ">=13.0.1", 23 "prettier": "^2.6.2" 24 } 25 25 } -
add-wpgraphql-seo/tags/4.23.1/readme.txt
r2932770 r3209864 3 3 Tags: SEO, Yoast, WPGraphQL, GraphQL, Headless WordPress, Decoupled WordPress, JAMStack 4 4 Requires at least: 5.0 5 Tested up to: 6. 1.15 Tested up to: 6.7.1 6 6 Requires PHP: 7.1 7 Stable tag: 4.22.57 Stable tag: v4.23.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
add-wpgraphql-seo/tags/4.23.1/wp-graphql-yoast-seo.php
r2932770 r3209864 2 2 3 3 /** 4 * Plugin Name: Add WPGraphQL SEO 5 * Plugin URI: https://github.com/ashhitch/wp-graphql-yoast-seo 6 * Description: A WPGraphQL Extension that adds support for Yoast SEO 7 * Author: Ash Hitchcock 8 * Author URI: https://www.ashleyhitchcock.com 9 * Text Domain: wp-graphql-yoast-seo 10 * Domain Path: /languages 11 * Version: 4.22.5 4 * Plugin Name: Add WPGraphQL SEO 5 * Plugin URI: https://github.com/ashhitch/wp-graphql-yoast-seo 6 * Description: A WPGraphQL Extension that adds support for Yoast SEO 7 * Author: Ash Hitchcock 8 * Author URI: https://www.ashleyhitchcock.com 9 * Text Domain: wp-graphql-yoast-seo 10 * Domain Path: /languages 11 * Version: v4.23.1 12 * Requires Plugins: wp-graphql, wordpress-seo 12 13 * 13 * @package WP_Graphql_YOAST_SEO14 * @package WP_Graphql_YOAST_SEO 14 15 */ 15 16 … … 155 156 if ($post_type_object->graphql_single_name) { 156 157 $carry[wp_gql_seo_get_field_key($post_type_object->graphql_single_name)] = ['type' => 'SEOContentType']; 158 } 159 } 160 return $carry; 161 } 162 163 function wp_gql_seo_build_taxonomy_types($taxonomies) 164 { 165 $carry = []; 166 foreach ($taxonomies as $taxonomy) { 167 $taxonomy_object = get_taxonomy($taxonomy); 168 if ($taxonomy_object->graphql_single_name) { 169 $carry[wp_gql_seo_get_field_key($taxonomy_object->graphql_single_name)] = ['type' => 'SEOTaxonomyType']; 157 170 } 158 171 } … … 231 244 } 232 245 246 function wp_gql_seo_build_taxonomy_data($taxonomies, $all) 247 { 248 $carry = []; 249 250 // Validate input parameters 251 if (!is_array($taxonomies) || empty($taxonomies) || !is_array($all) || empty($all)) { 252 return $carry; 253 } 254 255 foreach ($taxonomies as $taxonomy) { 256 $taxonomy_object = get_taxonomy($taxonomy); 257 258 259 // Validate taxonomy object 260 if (!$taxonomy_object || !$taxonomy_object->graphql_single_name) { 261 continue; 262 } 263 264 $tag = wp_gql_seo_get_field_key($taxonomy_object->graphql_single_name); 265 $carry[$tag] = [ 266 'archive' => [ 267 'title' => wp_gql_seo_format_string(wp_gql_seo_replace_vars($all['title-tax-' . $taxonomy] ?? null)), 268 'metaDesc' => wp_gql_seo_format_string(wp_gql_seo_replace_vars($all['metadesc-tax-' . $taxonomy] ?? null)), 269 'metaRobotsNoindex' => boolval($all['noindex-tax-' . $taxonomy] ?? false), 270 ], 271 ]; 272 } 273 274 return $carry; 275 } 276 233 277 function wp_gql_seo_get_post_type_graphql_fields($post, array $args, AppContext $context) 234 278 { … … 316 360 $taxonomies = \WPGraphQL::get_allowed_taxonomies(); 317 361 362 $allTypes = wp_gql_seo_build_content_types($post_types); 363 $allTaxonomies = wp_gql_seo_build_taxonomy_types($taxonomies); 364 318 365 // If WooCommerce installed then add these post types and taxonomies 319 366 if (class_exists('\WooCommerce')) { … … 603 650 ]); 604 651 605 $allTypes = wp_gql_seo_build_content_types($post_types);606 607 652 register_graphql_object_type('SEOContentTypes', [ 608 653 'description' => __('The Yoast SEO search appearance content types', 'wp-graphql-yoast-seo'), 609 654 'fields' => $allTypes, 655 ]); 656 657 658 register_graphql_object_type('SEOTaxonomyTypeArchive', [ 659 'description' => __('The Yoast SEO search appearance Taxonomy types fields', 'wp-graphql-yoast-seo'), 660 'fields' => [ 661 'title' => ['type' => 'String'], 662 'metaDesc' => ['type' => 'String'], 663 'metaRobotsNoindex' => ['type' => 'Boolean'], 664 ], 665 ]); 666 register_graphql_object_type('SEOTaxonomyType', [ 667 'description' => __('The Yoast SEO search appearance Taxonomy types fields', 'wp-graphql-yoast-seo'), 668 'fields' => [ 669 'archive' => ['type' => 'SEOTaxonomyTypeArchive'], 670 ], 671 ]); 672 673 register_graphql_object_type('SEOTaxonomyTypes', [ 674 'description' => __('The Yoast SEO archive configuration data for taxonomies', 'wp-graphql-yoast-seo'), 675 'fields' => $allTaxonomies, 610 676 ]); 611 677 … … 625 691 'openGraph' => ['type' => 'SEOOpenGraph'], 626 692 'contentTypes' => ['type' => 'SEOContentTypes'], 693 'taxonomyArchives' => ['type' => 'SEOTaxonomyTypes'], 627 694 ], 628 695 ]); … … 689 756 'type' => 'SEOConfig', 690 757 'description' => __('Returns seo site data', 'wp-graphql-yoast-seo'), 691 'resolve' => function ($source, array $args, AppContext $context) use ($post_types ) {758 'resolve' => function ($source, array $args, AppContext $context) use ($post_types, $taxonomies) { 692 759 $wpseo_options = WPSEO_Options::get_instance(); 693 760 $all = $wpseo_options->get_all(); … … 708 775 709 776 $contentTypes = wp_gql_seo_build_content_type_data($post_types, $all); 777 $taxonomyTypes = wp_gql_seo_build_taxonomy_data($taxonomies, $all); 710 778 711 779 $homepage = [ … … 731 799 return [ 732 800 'contentTypes' => $contentTypes, 801 'taxonomyArchives' => $taxonomyTypes, 733 802 'meta' => [ 734 803 'homepage' => $homepage, … … 821 890 ], 822 891 ], 892 823 893 ]; 824 894 }, … … 1060 1130 ], 1061 1131 ]; 1132 1062 1133 wp_reset_query(); 1063 1134 -
add-wpgraphql-seo/trunk/CHANGELOG.md
r2932770 r3209864 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.23.0] - 2024-12-17 9 10 ### Added 11 - Taxonomies archive configuration 7 12 8 13 ## [4.22.5] - 2023-06-30 -
add-wpgraphql-seo/trunk/package.json
r2932770 r3209864 1 1 { 2 "name": "wp-graphql-yoast-seo",3 "version": "4.22.5",4 "description": "A WPGraphQL Extension that adds support for Yoast SEO",5 "scripts": {6 "test": "echo \"Error: no test specified\" && exit 1",7 "prettier": "prettier wp-graphql-yoast-seo.php --write",8 "prepare": "husky install"9 },10 "repository": {11 "type": "git",12 "url": "git+https://github.com/ashhitch/wp-graphql-yoast-seo.git"13 },14 "author": "Ash Hitchcock",15 "bugs": {16 "url": "https://github.com/ashhitch/wp-graphql-yoast-seo/issues"17 },18 "homepage": "https://github.com/ashhitch/wp-graphql-yoast-seo#readme",19 "devDependencies": {20 "@prettier/plugin-php": "^0.18.7",21 "husky": ">=8.0.1",22 "lint-staged": ">=13.0.1",23 "prettier": "^2.6.2"24 }2 "name": "wp-graphql-yoast-seo", 3 "version": "v4.23.1", 4 "description": "A WPGraphQL Extension that adds support for Yoast SEO", 5 "scripts": { 6 "test": "echo \"Error: no test specified\" && exit 1", 7 "prettier": "prettier wp-graphql-yoast-seo.php --write", 8 "prepare": "husky install" 9 }, 10 "repository": { 11 "type": "git", 12 "url": "git+https://github.com/ashhitch/wp-graphql-yoast-seo.git" 13 }, 14 "author": "Ash Hitchcock", 15 "bugs": { 16 "url": "https://github.com/ashhitch/wp-graphql-yoast-seo/issues" 17 }, 18 "homepage": "https://github.com/ashhitch/wp-graphql-yoast-seo#readme", 19 "devDependencies": { 20 "@prettier/plugin-php": "^0.18.7", 21 "husky": ">=8.0.1", 22 "lint-staged": ">=13.0.1", 23 "prettier": "^2.6.2" 24 } 25 25 } -
add-wpgraphql-seo/trunk/readme.txt
r2932770 r3209864 3 3 Tags: SEO, Yoast, WPGraphQL, GraphQL, Headless WordPress, Decoupled WordPress, JAMStack 4 4 Requires at least: 5.0 5 Tested up to: 6. 1.15 Tested up to: 6.7.1 6 6 Requires PHP: 7.1 7 Stable tag: 4.22.57 Stable tag: v4.23.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
add-wpgraphql-seo/trunk/wp-graphql-yoast-seo.php
r2932770 r3209864 2 2 3 3 /** 4 * Plugin Name: Add WPGraphQL SEO 5 * Plugin URI: https://github.com/ashhitch/wp-graphql-yoast-seo 6 * Description: A WPGraphQL Extension that adds support for Yoast SEO 7 * Author: Ash Hitchcock 8 * Author URI: https://www.ashleyhitchcock.com 9 * Text Domain: wp-graphql-yoast-seo 10 * Domain Path: /languages 11 * Version: 4.22.5 4 * Plugin Name: Add WPGraphQL SEO 5 * Plugin URI: https://github.com/ashhitch/wp-graphql-yoast-seo 6 * Description: A WPGraphQL Extension that adds support for Yoast SEO 7 * Author: Ash Hitchcock 8 * Author URI: https://www.ashleyhitchcock.com 9 * Text Domain: wp-graphql-yoast-seo 10 * Domain Path: /languages 11 * Version: v4.23.1 12 * Requires Plugins: wp-graphql, wordpress-seo 12 13 * 13 * @package WP_Graphql_YOAST_SEO14 * @package WP_Graphql_YOAST_SEO 14 15 */ 15 16 … … 155 156 if ($post_type_object->graphql_single_name) { 156 157 $carry[wp_gql_seo_get_field_key($post_type_object->graphql_single_name)] = ['type' => 'SEOContentType']; 158 } 159 } 160 return $carry; 161 } 162 163 function wp_gql_seo_build_taxonomy_types($taxonomies) 164 { 165 $carry = []; 166 foreach ($taxonomies as $taxonomy) { 167 $taxonomy_object = get_taxonomy($taxonomy); 168 if ($taxonomy_object->graphql_single_name) { 169 $carry[wp_gql_seo_get_field_key($taxonomy_object->graphql_single_name)] = ['type' => 'SEOTaxonomyType']; 157 170 } 158 171 } … … 231 244 } 232 245 246 function wp_gql_seo_build_taxonomy_data($taxonomies, $all) 247 { 248 $carry = []; 249 250 // Validate input parameters 251 if (!is_array($taxonomies) || empty($taxonomies) || !is_array($all) || empty($all)) { 252 return $carry; 253 } 254 255 foreach ($taxonomies as $taxonomy) { 256 $taxonomy_object = get_taxonomy($taxonomy); 257 258 259 // Validate taxonomy object 260 if (!$taxonomy_object || !$taxonomy_object->graphql_single_name) { 261 continue; 262 } 263 264 $tag = wp_gql_seo_get_field_key($taxonomy_object->graphql_single_name); 265 $carry[$tag] = [ 266 'archive' => [ 267 'title' => wp_gql_seo_format_string(wp_gql_seo_replace_vars($all['title-tax-' . $taxonomy] ?? null)), 268 'metaDesc' => wp_gql_seo_format_string(wp_gql_seo_replace_vars($all['metadesc-tax-' . $taxonomy] ?? null)), 269 'metaRobotsNoindex' => boolval($all['noindex-tax-' . $taxonomy] ?? false), 270 ], 271 ]; 272 } 273 274 return $carry; 275 } 276 233 277 function wp_gql_seo_get_post_type_graphql_fields($post, array $args, AppContext $context) 234 278 { … … 316 360 $taxonomies = \WPGraphQL::get_allowed_taxonomies(); 317 361 362 $allTypes = wp_gql_seo_build_content_types($post_types); 363 $allTaxonomies = wp_gql_seo_build_taxonomy_types($taxonomies); 364 318 365 // If WooCommerce installed then add these post types and taxonomies 319 366 if (class_exists('\WooCommerce')) { … … 603 650 ]); 604 651 605 $allTypes = wp_gql_seo_build_content_types($post_types);606 607 652 register_graphql_object_type('SEOContentTypes', [ 608 653 'description' => __('The Yoast SEO search appearance content types', 'wp-graphql-yoast-seo'), 609 654 'fields' => $allTypes, 655 ]); 656 657 658 register_graphql_object_type('SEOTaxonomyTypeArchive', [ 659 'description' => __('The Yoast SEO search appearance Taxonomy types fields', 'wp-graphql-yoast-seo'), 660 'fields' => [ 661 'title' => ['type' => 'String'], 662 'metaDesc' => ['type' => 'String'], 663 'metaRobotsNoindex' => ['type' => 'Boolean'], 664 ], 665 ]); 666 register_graphql_object_type('SEOTaxonomyType', [ 667 'description' => __('The Yoast SEO search appearance Taxonomy types fields', 'wp-graphql-yoast-seo'), 668 'fields' => [ 669 'archive' => ['type' => 'SEOTaxonomyTypeArchive'], 670 ], 671 ]); 672 673 register_graphql_object_type('SEOTaxonomyTypes', [ 674 'description' => __('The Yoast SEO archive configuration data for taxonomies', 'wp-graphql-yoast-seo'), 675 'fields' => $allTaxonomies, 610 676 ]); 611 677 … … 625 691 'openGraph' => ['type' => 'SEOOpenGraph'], 626 692 'contentTypes' => ['type' => 'SEOContentTypes'], 693 'taxonomyArchives' => ['type' => 'SEOTaxonomyTypes'], 627 694 ], 628 695 ]); … … 689 756 'type' => 'SEOConfig', 690 757 'description' => __('Returns seo site data', 'wp-graphql-yoast-seo'), 691 'resolve' => function ($source, array $args, AppContext $context) use ($post_types ) {758 'resolve' => function ($source, array $args, AppContext $context) use ($post_types, $taxonomies) { 692 759 $wpseo_options = WPSEO_Options::get_instance(); 693 760 $all = $wpseo_options->get_all(); … … 708 775 709 776 $contentTypes = wp_gql_seo_build_content_type_data($post_types, $all); 777 $taxonomyTypes = wp_gql_seo_build_taxonomy_data($taxonomies, $all); 710 778 711 779 $homepage = [ … … 731 799 return [ 732 800 'contentTypes' => $contentTypes, 801 'taxonomyArchives' => $taxonomyTypes, 733 802 'meta' => [ 734 803 'homepage' => $homepage, … … 821 890 ], 822 891 ], 892 823 893 ]; 824 894 }, … … 1060 1130 ], 1061 1131 ]; 1132 1062 1133 wp_reset_query(); 1063 1134
Note: See TracChangeset
for help on using the changeset viewer.