Yoast\WP\SEO\Llms_Txt\Infrastructure\Markdown_Services
Description_Adapter{}
The adapter of the description.
Хуков нет.
Использование
$Description_Adapter = new Description_Adapter(); // use class methods
Методы
- public __construct(
- public get_description()
Код Description_Adapter{} Description Adapter{} Yoast 27.8
class Description_Adapter {
/**
* Holds the meta helper surface.
*
* @var Meta_Surface
*/
private $meta;
/**
* Class constructor.
*
* @param Meta_Surface $meta The meta surface.
*/
public function __construct(
Meta_Surface $meta
) {
$this->meta = $meta;
}
/**
* Gets the description.
*
* @return Description The description.
*/
public function get_description(): Description {
$meta_description = $this->meta->for_home_page()->meta_description;
// In a lot of cases, the homepage's meta description falls back to the site's tagline.
// But that is already used for the title section, so let's try to not have duplicate content.
if ( $meta_description === \get_bloginfo( 'description' ) ) {
return new Description( '' );
}
return new Description( $meta_description );
}
}