Skip to main content

Meta tags

DrevOps\BehatSteps\Steps\Web\MetatagTrait - Source, Steps

Assert <meta> tags and head/SEO markup in page markup.

public function metatagAssertHreflangAlternatesReciprocal(array $alternates): void

Assert that every hreflang alternate page links back to the current URL

public function metatagAssertHreflangAlternatesValid(array $alternates): void

Assert that hreflang alternates are valid

public function metatagAssertMetaSetExists(array $names, string $label): void

Assert that a set of meta tags is present and non-empty

public function metatagFindCanonicalHref(): ?string

Find the canonical URL href

public function metatagFindMeta(string $meta_name): ?NodeElement

Find a meta tag by its "name" or "property" attribute

public function metatagFindMetaContent(string $meta_name): ?string

Find the content of a meta tag by its "name" or "property" attribute

public function metatagFindMetaWithAttributes(array $attributes): ?NodeElement

Find the first meta tag carrying every given attribute value

public function metatagGetHreflangAlternates(): array

Get the hreflang alternates present on the current page

public function metatagGetRequiredOpenGraphTags(): array

The Open Graph meta tags required by "the Open Graph tags should be valid"

public function metatagGetRequiredTwitterCardTags(): array

The Twitter Card tags required by "the Twitter Card tags should be valid"

public function metatagGetRobotsDirectives(): array

Get the robots meta tag directives as lower-cased tokens

public function metatagIsIndexable(): bool

Determine whether the current page is indexable

public function metatagIsValidHreflang(string $value): bool

Determine whether a hreflang value is a well-formed language code

public function metatagResponseHasNoindexHeader(): bool

Determine whether the X-Robots-Tag response header carries "noindex"