Introduction
laravel/head is an official Laravel package that provides a fluent API for managing your application’s document<head>. It supports title and meta tags, Open Graph, canonical URLs, robots directives, performance hints, and structured data, and works across Blade, Livewire, and Inertia. v0.1.0 was released on July 28, 2026.
Resolution Precedence
Page head data resolves from five layers, listed from lowest to highest priority:- Page defaults
- Route group metadata
- Route metadata
- Runtime metadata
- Error metadata
Defaults
Register page defaults in a service provider:Acme renders as-is. When a higher layer sets a title, the inherited suffix is applied — Head::title('About') renders About - Acme. Pass exact: true for titles that should ignore the inherited prefix or suffix.
Canonical URLs use the current request URL. Pass a string for an explicit URL: Head::canonical('/about'). URLs are normalized to https by default; pass forceHttps: false to preserve the request scheme.
Route Metadata
Static pages can define metadata directly on the route:withHead() stores plain arrays through Laravel’s native route metadata API, keeping it compatible with cached routes.
Supported Properties
Runtime Metadata
For values that aren’t known until a request arrives — such as a post title — set them at runtime via theHead facade:
when() and unless():
Error Pages
Register metadata for specific HTTP status codes:Open Graph and Twitter Cards
Set Open Graph properties withog(), and add repeatable media with dedicated methods:
title and description automatically fill missing og:title and og:description values.
For a single OG image with no other attributes, use the image: shorthand on og():
Theme Colors and App Metadata
Theme colors can be set globally, per route, or at runtime. Media-specific colors are supported via theMedia enum:
Progressive Web Apps
Thepwa() helper configures the common <head> tags needed for an installable web app:
Performance and Discovery
Laravel Head renders performance hints, pagination links, locale alternates, and feed discovery:preloadAsset() and prefetchAsset() resolve the URL through asset() and detect the as attribute from the file extension. Font preloads automatically include crossorigin:
Custom Tags
For tags without a dedicated method, usemeta() and link():
meta() uses name= for regular meta tags. For keys that normally use property= such as Open Graph (og:) or article metadata (article:), it switches automatically:
Structured Data (JSON-LD)
Built-in schema builders cover common JSON-LD types:article, blogPosting, product, offer, brand, breadcrumbs, faq, organization, person, webPage, and webSite. Unknown factory methods fall back to a generic schema object.
Breadcrumb items may be added one at a time or in bulk — positions are assigned automatically:
Summary
laravel/head provides a unified, fluent API for managing <head> metadata across Blade, Livewire, and Inertia. Its five-layer resolution model — defaults, route group, route, runtime, and error — keeps site-wide consistency while allowing per-page flexibility, without scattering <meta> tags across templates.
laravel/head repository
Source code and latest updates.