Yoast\WP\SEO\Generators\Schema
WebPage::generate()
Returns WebPage schema data.
Метод класса: WebPage{}
Хуков нет.
Возвращает
Массив<Строку|Массив<Строку>>
. WebPage schema data.
Использование
$WebPage = new WebPage(); $WebPage->generate();
Код WebPage::generate() WebPage::generate Yoast 22.4
public function generate() { $data = [ '@type' => $this->context->schema_page_type, '@id' => $this->context->main_schema_id, 'url' => $this->context->canonical, 'name' => $this->helpers->schema->html->smart_strip_tags( $this->context->title ), 'isPartOf' => [ '@id' => $this->context->site_url . Schema_IDs::WEBSITE_HASH, ], ]; if ( empty( $this->context->canonical ) && \is_search() ) { $data['url'] = $this->build_search_url(); } if ( $this->helpers->current_page->is_front_page() ) { if ( $this->context->site_represents_reference ) { $data['about'] = $this->context->site_represents_reference; } } $data = $this->add_image( $data ); if ( $this->context->indexable->object_type === 'post' ) { $data['datePublished'] = $this->helpers->date->format( $this->context->post->post_date_gmt ); $data['dateModified'] = $this->helpers->date->format( $this->context->post->post_modified_gmt ); if ( $this->context->indexable->object_sub_type === 'post' ) { $data = $this->add_author( $data, $this->context->post ); } } if ( ! empty( $this->context->description ) ) { $data['description'] = $this->helpers->schema->html->smart_strip_tags( $this->context->description ); } if ( $this->add_breadcrumbs() ) { $data['breadcrumb'] = [ '@id' => $this->context->canonical . Schema_IDs::BREADCRUMB_HASH, ]; } if ( ! empty( $this->context->main_entity_of_page ) ) { $data['mainEntity'] = $this->context->main_entity_of_page; } $data = $this->helpers->schema->language->add_piece_language( $data ); $data = $this->add_potential_action( $data ); return $data; }