How can I add content into the head of the storefront?
The content for head pipeline can be used to inject content into the <head> element of the page, such as stylesheets, meta tags, scripts, or other head elements.
// Globally
\Aero\Store\Pipelines\ContentForHead::extend(function (string $content, \Closure $next) {
return $next($content . view('acme::script'))
});
// Product Page Only
\Aero\Store\Http\Responses\ProductPage::extend(function (\Aero\Store\Http\Responses\ProductPage $page, \Closure $next) {
\Aero\Store\Pipelines\ContentForHead::extend(function (string $content, \Closure $next) {
return $next($content . view('acme::script'))
});
});
Parameters
| Parameter | Type | Description |
$content |
string |
The content to be injected into the body. |
$next |
\Closure |
The next step in the query pipeline. |