Hook: cms_head
Last updated on May 21, 2026 03:18
Overview
Type: Action
Location: Theme layouts/app.blade.php
Output hook inside the HTML <head> tag. Used by core to inject SEO meta tags. Modules and themes can add custom scripts, stylesheets, or meta tags.
Parameters
None.
Usage Example
Hook::addAction('cms_head', function () {
$gaId = get_option('google_analytics_id', null, 'integrations');
if ($gaId) {
echo "<script async src='https://www.googletagmanager.com/gtag/js?id={$gaId}'></script>";
}
});
Related Hooks
- seo.canonical_url - Override canonical URL