HeadBuilder
class HeadBuilder implements Transient
Traits
Methods
Get the schema factory used to resolve schema callbacks.
Use $exact to render the title without inherited prefix or suffix.
Set the theme color for the given media.
Set whether the page supports web app mode.
Set the Apple web app status bar style.
Set the canonical URL and its normalization options.
Add a robots meta tag with the "all" directive, allowing search engines to index the page.
Add a robots meta tag with the "none" directive, preventing search engines from indexing the page.
Set Open Graph metadata.
Add an Open Graph image.
Add an Open Graph video.
Add Open Graph audio.
Set Twitter card metadata.
Set the Twitter card image.
Add a resource preload hint.
Add an asset preload hint.
Add a resource prefetch hint.
Add an asset prefetch hint.
Add a connection hint for an origin.
Add a named or property-based meta tag.
Add a link with optional attributes.
Add an icon candidate.
Add a favicon candidate.
Add an Apple touch icon.
Add a pinned-tab mask icon.
Set the web app manifest link.
Add an Apple startup image.
Set progressive web app metadata.
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Create a builder for the given head data.
Details
at line 30
protected HeadData
headData()
Get the head data instance the fluent methods should write to.
at line 38
protected SchemaFactory
schemaFactory()
Get the schema factory used to resolve schema callbacks.
in
BuildsHead at line 47
BuildsHead
title(string $title, string|null $prefix = null, string|null $suffix = null, bool|null $exact = null)
Use $exact to render the title without inherited prefix or suffix.
in
BuildsHead at line 57
BuildsHead
description(string $description)
Set the page description.
in
BuildsHead at line 67
BuildsHead
themeColor(string $color, Media|string|null $media = null)
Set the theme color for the given media.
in
BuildsHead at line 75
BuildsHead
applicationName(string $name)
Set the application name.
in
BuildsHead at line 83
BuildsHead
colorScheme(string $scheme)
Set the supported color schemes.
in
BuildsHead at line 91
BuildsHead
referrer(string $policy)
Set the referrer policy.
in
BuildsHead at line 99
BuildsHead
viewport(string $content)
Set the viewport metadata.
in
BuildsHead at line 107
BuildsHead
appleWebAppTitle(string $title)
Set the Apple web app title.
in
BuildsHead at line 115
BuildsHead
webAppCapable(bool $capable = true)
Set whether the page supports web app mode.
in
BuildsHead at line 123
BuildsHead
appleWebAppStatusBarStyle(string $style)
Set the Apple web app status bar style.
in
BuildsHead at line 131
BuildsHead
canonical(string|null $url = null, bool|null $forceHttps = null, bool|null $trailingSlash = null)
Set the canonical URL and its normalization options.
in
BuildsHead at line 143
BuildsHead
robots(string|RobotsRule|array $directives)
Set the robots directives.
in
BuildsHead at line 153
BuildsHead
searchableByRobots()
Add a robots meta tag with the "all" directive, allowing search engines to index the page.
in
BuildsHead at line 161
BuildsHead
hiddenFromRobots()
Add a robots meta tag with the "none" directive, preventing search engines from indexing the page.
in
BuildsHead at line 169
BuildsHead
og(OgType|string|null $type = null, string|null $title = null, string|null $description = null, string|null $url = null, string|null $image = null, string|null $video = null, string|null $audio = null, string|null $siteName = null, string|null $locale = null, string|null $determiner = null)
Set Open Graph metadata.
in
BuildsHead at line 200
BuildsHead
ogImage(string $url, string|null $alt = null, int|null $width = null, int|null $height = null, ImageType|string|null $type = null, string|null $secureUrl = null)
Add an Open Graph image.
in
BuildsHead at line 216
BuildsHead
ogVideo(string $url, string|null $alt = null, int|null $width = null, int|null $height = null, string|null $type = null, string|null $secureUrl = null)
Add an Open Graph video.
in
BuildsHead at line 232
BuildsHead
ogAudio(string $url, string|null $type = null, string|null $secureUrl = null)
Add Open Graph audio.
in
BuildsHead at line 242
BuildsHead
twitter(TwitterCard|string|null $card = null, string|null $site = null, string|null $creator = null, string|null $title = null, string|null $description = null, string|null $image = null)
Set Twitter card metadata.
in
BuildsHead at line 265
BuildsHead
twitterImage(string $url, string|null $alt = null)
Set the Twitter card image.
in
BuildsHead at line 275
BuildsHead
preload(string $href, string|null $as = null, bool|string|null $crossorigin = null, ImageType|string|null $type = null, Media|string|null $media = null)
Add a resource preload hint.
in
BuildsHead at line 285
BuildsHead
preloadAsset(string $path, string|null $as = null, bool|string|null $crossorigin = null, ImageType|string|null $type = null, Media|string|null $media = null)
Add an asset preload hint.
in
BuildsHead at line 295
BuildsHead
prefetch(string $href, string|null $as = null)
Add a resource prefetch hint.
in
BuildsHead at line 305
BuildsHead
prefetchAsset(string $path, string|null $as = null)
Add an asset prefetch hint.
in
BuildsHead at line 315
BuildsHead
preconnect(string $href, bool|string|null $crossorigin = null)
Add a connection hint for an origin.
in
BuildsHead at line 325
BuildsHead
dnsPrefetch(string $href)
Add a DNS prefetch hint.
in
BuildsHead at line 337
BuildsHead
paginate(Paginator|CursorPaginator $paginator)
Add rel=prev/next links from a paginator instance.
in
BuildsHead at line 349
BuildsHead
alternates(array $alternates)
Add localized alternate URLs.
in
BuildsHead at line 359
BuildsHead
feed(string $href, string $title, string $type = 'rss')
Add a feed link.
in
BuildsHead at line 371
BuildsHead
schema(SchemaObject|array|callable $schema)
Add a JSON-LD schema object to the page.
in
BuildsHead at line 385
BuildsHead
meta(string $key, string $content, bool|null $property = null, Media|string|null $media = null)
Add a named or property-based meta tag.
in
BuildsHead at line 397
BuildsHead
link(string $rel, string $href, array $attributes = [])
Add a link with optional attributes.
in
BuildsHead at line 407
BuildsHead
icon(string $href, ImageType|string|null $type = null, string|null $sizes = null, Media|string|null $media = null)
Add an icon candidate.
in
BuildsHead at line 419
BuildsHead
favicon(string $href, ImageType|string|null $type = null, string|null $sizes = null, Media|string|null $media = null)
Add a favicon candidate.
in
BuildsHead at line 427
BuildsHead
appleTouchIcon(string $href, string|null $sizes = null)
Add an Apple touch icon.
in
BuildsHead at line 437
BuildsHead
maskIcon(string $href, string|null $color = null)
Add a pinned-tab mask icon.
in
BuildsHead at line 447
BuildsHead
manifest(string $href = '/site.webmanifest', bool|string|null $crossorigin = null)
Set the web app manifest link.
in
BuildsHead at line 457
BuildsHead
appleTouchStartupImage(string $href, Media|string|null $media = null)
Add an Apple startup image.
in
BuildsHead at line 467
BuildsHead
pwa(string $name, string $manifest = '/site.webmanifest', string|null $themeColor = null, string|null $appleTouchIcon = null, string|null $appleTouchIconSizes = '180x180', string|null $appleWebAppStatusBarStyle = null)
Set progressive web app metadata.
in
BuildsHead at line 501
static protected array
linkAttributes(array $attributes)
Remove unspecified link attributes.
in
Conditionable at line 23
mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
in
Conditionable at line 56
mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
at line 21
__construct(HeadData $data, SchemaFactory|null $schemaFactory = null)
Create a builder for the given head data.