Plugin Directory

Changeset 3209864


Ignore:
Timestamp:
12/18/2024 12:30:01 PM (16 months ago)
Author:
ash_hitch
Message:

Update to version 4.23.1 from GitHub

Location:
add-wpgraphql-seo
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • add-wpgraphql-seo/tags/4.23.1/CHANGELOG.md

    r2932770 r3209864  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
    66and 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
    712
    813## [4.22.5] - 2023-06-30
  • add-wpgraphql-seo/tags/4.23.1/package.json

    r2932770 r3209864  
    11{
    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  }
    2525}
  • add-wpgraphql-seo/tags/4.23.1/readme.txt

    r2932770 r3209864  
    33Tags: SEO, Yoast, WPGraphQL, GraphQL, Headless WordPress, Decoupled WordPress, JAMStack
    44Requires at least: 5.0
    5 Tested up to: 6.1.1
     5Tested up to: 6.7.1
    66Requires PHP: 7.1
    7 Stable tag: 4.22.5
     7Stable tag: v4.23.1
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • add-wpgraphql-seo/tags/4.23.1/wp-graphql-yoast-seo.php

    r2932770 r3209864  
    22
    33/**
    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
    1213 *
    13  * @package         WP_Graphql_YOAST_SEO
     14 * @package WP_Graphql_YOAST_SEO
    1415 */
    1516
     
    155156            if ($post_type_object->graphql_single_name) {
    156157                $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'];
    157170            }
    158171        }
     
    231244    }
    232245
     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
    233277    function wp_gql_seo_get_post_type_graphql_fields($post, array $args, AppContext $context)
    234278    {
     
    316360        $taxonomies = \WPGraphQL::get_allowed_taxonomies();
    317361
     362        $allTypes = wp_gql_seo_build_content_types($post_types);
     363        $allTaxonomies = wp_gql_seo_build_taxonomy_types($taxonomies);
     364
    318365        // If WooCommerce installed then add these post types and taxonomies
    319366        if (class_exists('\WooCommerce')) {
     
    603650        ]);
    604651
    605         $allTypes = wp_gql_seo_build_content_types($post_types);
    606 
    607652        register_graphql_object_type('SEOContentTypes', [
    608653            'description' => __('The Yoast SEO search appearance content types', 'wp-graphql-yoast-seo'),
    609654            '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,
    610676        ]);
    611677
     
    625691                'openGraph' => ['type' => 'SEOOpenGraph'],
    626692                'contentTypes' => ['type' => 'SEOContentTypes'],
     693                'taxonomyArchives' => ['type' => 'SEOTaxonomyTypes'],
    627694            ],
    628695        ]);
     
    689756            'type' => 'SEOConfig',
    690757            '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) {
    692759                $wpseo_options = WPSEO_Options::get_instance();
    693760                $all = $wpseo_options->get_all();
     
    708775
    709776                $contentTypes = wp_gql_seo_build_content_type_data($post_types, $all);
     777                $taxonomyTypes = wp_gql_seo_build_taxonomy_data($taxonomies, $all);
    710778
    711779                $homepage = [
     
    731799                return [
    732800                    'contentTypes' => $contentTypes,
     801                    'taxonomyArchives' => $taxonomyTypes,
    733802                    'meta' => [
    734803                        'homepage' => $homepage,
     
    821890                        ],
    822891                    ],
     892               
    823893                ];
    824894            },
     
    10601130                            ],
    10611131                        ];
     1132
    10621133                        wp_reset_query();
    10631134
  • add-wpgraphql-seo/trunk/CHANGELOG.md

    r2932770 r3209864  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
    66and 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
    712
    813## [4.22.5] - 2023-06-30
  • add-wpgraphql-seo/trunk/package.json

    r2932770 r3209864  
    11{
    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  }
    2525}
  • add-wpgraphql-seo/trunk/readme.txt

    r2932770 r3209864  
    33Tags: SEO, Yoast, WPGraphQL, GraphQL, Headless WordPress, Decoupled WordPress, JAMStack
    44Requires at least: 5.0
    5 Tested up to: 6.1.1
     5Tested up to: 6.7.1
    66Requires PHP: 7.1
    7 Stable tag: 4.22.5
     7Stable tag: v4.23.1
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • add-wpgraphql-seo/trunk/wp-graphql-yoast-seo.php

    r2932770 r3209864  
    22
    33/**
    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
    1213 *
    13  * @package         WP_Graphql_YOAST_SEO
     14 * @package WP_Graphql_YOAST_SEO
    1415 */
    1516
     
    155156            if ($post_type_object->graphql_single_name) {
    156157                $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'];
    157170            }
    158171        }
     
    231244    }
    232245
     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
    233277    function wp_gql_seo_get_post_type_graphql_fields($post, array $args, AppContext $context)
    234278    {
     
    316360        $taxonomies = \WPGraphQL::get_allowed_taxonomies();
    317361
     362        $allTypes = wp_gql_seo_build_content_types($post_types);
     363        $allTaxonomies = wp_gql_seo_build_taxonomy_types($taxonomies);
     364
    318365        // If WooCommerce installed then add these post types and taxonomies
    319366        if (class_exists('\WooCommerce')) {
     
    603650        ]);
    604651
    605         $allTypes = wp_gql_seo_build_content_types($post_types);
    606 
    607652        register_graphql_object_type('SEOContentTypes', [
    608653            'description' => __('The Yoast SEO search appearance content types', 'wp-graphql-yoast-seo'),
    609654            '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,
    610676        ]);
    611677
     
    625691                'openGraph' => ['type' => 'SEOOpenGraph'],
    626692                'contentTypes' => ['type' => 'SEOContentTypes'],
     693                'taxonomyArchives' => ['type' => 'SEOTaxonomyTypes'],
    627694            ],
    628695        ]);
     
    689756            'type' => 'SEOConfig',
    690757            '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) {
    692759                $wpseo_options = WPSEO_Options::get_instance();
    693760                $all = $wpseo_options->get_all();
     
    708775
    709776                $contentTypes = wp_gql_seo_build_content_type_data($post_types, $all);
     777                $taxonomyTypes = wp_gql_seo_build_taxonomy_data($taxonomies, $all);
    710778
    711779                $homepage = [
     
    731799                return [
    732800                    'contentTypes' => $contentTypes,
     801                    'taxonomyArchives' => $taxonomyTypes,
    733802                    'meta' => [
    734803                        'homepage' => $homepage,
     
    821890                        ],
    822891                    ],
     892               
    823893                ];
    824894            },
     
    10601130                            ],
    10611131                        ];
     1132
    10621133                        wp_reset_query();
    10631134
Note: See TracChangeset for help on using the changeset viewer.