Yoast\WP\SEO\Generators\Schema
WebPage::generate() public Yoast 1.0
Returns WebPage schema data.
{} Это метод класса: WebPage{}
Хуков нет.
Возвращает
Массив. WebPage schema data.
Использование
$WebPage = new WebPage(); $WebPage->generate();
Код WebPage::generate() WebPage::generate Yoast 15.6.2
public function generate() {
$data = [
'@type' => $this->context->schema_page_type,
'@id' => $this->context->canonical . Schema_IDs::WEBPAGE_HASH,
'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 ( $this->helpers->current_page->is_front_page() ) {
if ( $this->context->site_represents_reference ) {
$data['about'] = $this->context->site_represents_reference;
}
}
if ( $this->context->indexable->object_type === 'post' ) {
$this->add_image( $data );
$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,
];
}
$data = $this->helpers->schema->language->add_piece_language( $data );
$data = $this->add_potential_action( $data );
return $data;
}