Skip to content

Commit

Permalink
pass head data through helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ashhitch committed Jun 30, 2023
1 parent c6b5b64 commit d90f7c2
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions wp-graphql-yoast-seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ function wp_gql_seo_build_content_type_data($types, $all)
'metaRobotsIndex' => $meta->robots['index'] ?? 'noindex',
'metaRobotsFollow' => $meta->robots['follow'] ?? 'nofollow',
'breadcrumbTitle' => wp_gql_seo_format_string($all['bctitle-ptarchive-' . $type] ?? null),
'fullHead' =>
!empty($meta) && is_string($meta->get_head()) ? $meta->get_head() : $meta->get_head()->html,
'fullHead' => wp_gql_seo_get_full_head($meta),
],
];
}
Expand Down Expand Up @@ -275,9 +274,7 @@ function wp_gql_seo_get_post_type_graphql_fields($post, array $args, AppContext
'opengraphModifiedTime' => wp_gql_seo_format_string(
$meta !== false ? $meta->open_graph_article_modified_time : ''
),
'opengraphDescription' => wp_gql_seo_format_string(
$meta !== false ? $meta->open_graph_description : ''
),
'opengraphDescription' => wp_gql_seo_format_string($meta !== false ? $meta->open_graph_description : ''),
'opengraphImage' => function () use ($post, $context, $meta) {
$id = wp_gql_seo_get_og_image($meta !== false ? $meta->open_graph_images : []);

Expand Down Expand Up @@ -943,17 +940,7 @@ function wp_gql_seo_get_post_type_graphql_fields($post, array $args, AppContext
'language' => YoastSEO()->meta->for_author($user->userId)->language,
'region' => YoastSEO()->meta->for_author($user->userId)->region,
'breadcrumbTitle' => YoastSEO()->meta->for_author($user->userId)->breadcrumb_title,
'fullHead' => is_string(
YoastSEO()
->meta->for_author($user->userId)
->get_head()
)
? YoastSEO()
->meta->for_author($user->userId)
->get_head()
: YoastSEO()
->meta->for_author($user->userId)
->get_head()->html,
'fullHead' => wp_gql_seo_get_full_head(YoastSEO()->meta->for_author($user->userId)),
'social' => [
'facebook' => wp_gql_seo_format_string(get_the_author_meta('facebook', $user->userId)),
'twitter' => wp_gql_seo_format_string(get_the_author_meta('twitter', $user->userId)),
Expand Down Expand Up @@ -1067,17 +1054,7 @@ function wp_gql_seo_get_post_type_graphql_fields($post, array $args, AppContext
: null,
'breadcrumbs' => YoastSEO()->meta->for_term($term->term_id)->breadcrumbs,
'cornerstone' => boolval(YoastSEO()->meta->for_term($term->term_id)->is_cornerstone),
'fullHead' => is_string(
YoastSEO()
->meta->for_term($term->term_id)
->get_head()
)
? YoastSEO()
->meta->for_term($term->term_id)
->get_head()
: YoastSEO()
->meta->for_term($term->term_id)
->get_head()->html,
'fullHead' => wp_gql_seo_get_full_head(YoastSEO()->meta->for_term($term->term_id)),
'schema' => [
'raw' => json_encode($schemaArray, JSON_UNESCAPED_SLASHES),
],
Expand Down

0 comments on commit d90f7c2

Please sign in to comment.