Blade Directives Reference
Unfold CMS provides 30+ custom Blade directives available in all template files. This page is a complete reference for every directive.
Site Identity
| Directive |
Output |
Example |
@siteName |
Site name from settings |
<span>@siteName</span> |
@siteTagline |
Site tagline |
<p>@siteTagline</p> |
@siteLogo('classes') |
Logo <img> with classes, or site name if no logo |
@siteLogo('h-8 w-auto') |
@siteLogoUrl |
Logo URL only |
<img src="@siteLogoUrl" alt="Logo"> |
@siteFavicon |
Favicon URL |
<link rel="icon" href="@siteFavicon"> |
@supportEmail |
Support email address |
<a href="mailto:@supportEmail">Contact</a> |
@copyright |
Full copyright line with year and site name |
<footer>@copyright</footer> |
Content & Blocks
| Directive |
Description |
Example |
@block('slug') |
Render a content block by slug |
@block('homepage-hero') |
@hasBlock('slug') ... @endhasBlock |
Conditional: block exists and has content |
@hasBlock('sidebar') <div>@block('sidebar')</div> @endhasBlock |
Content blocks support conditional rendering:
@auth ... @endauth {{-- Show only to logged-in users --}}
@guest ... @endguest {{-- Show only to guests --}}
@admin ... @endadmin {{-- Show only to admins --}}
@role('role') ... @endrole {{-- Show only to specific roles --}}
Content blocks support user interpolation: {{ user.name }}, {{ user.email }}, {{ user.first_name }}.
| Directive |
Description |
Example |
@menu('slug') |
Render a menu by slug |
@menu('main-navigation') |
@menu(id) |
Render a menu by ID |
@menu(1) |
Advertising
| Directive |
Description |
Example |
@ad_zone('key') |
Render an ad zone |
@ad_zone('sidebar-banner') |
@hasAdZone('key') ... @endhasAdZone |
Conditional: ad zone has active ads |
@hasAdZone('header') @ad_zone('header') @endhasAdZone |
Settings & Template Options
| Directive |
Description |
Example |
@setting('key', 'default') |
Output site setting (escaped) |
@setting('app.tagline', 'Welcome') |
@settingRaw('key', 'default') |
Output site setting (unescaped HTML) |
@settingRaw('seo.meta_scripts') |
@hasSetting('key') ... @endhasSetting |
Conditional: setting is truthy |
@hasSetting('app.logo') ... @endhasSetting |
@option('key') |
Output template option (escaped) |
@option('hero.title') |
@optionRaw('key') |
Output template option (unescaped) |
@optionRaw('footer.custom_html') |
@hasOption('key') ... @endhasOption |
Conditional: option is truthy |
@hasOption('hero.enabled') ... @endhasOption |
@templateOption('key', 'default') |
Template option with default (escaped) |
@templateOption('sidebar.enabled', true) |
@templateOptionRaw('key', 'default') |
Template option with default (unescaped) |
@templateOptionRaw('custom.css') |
Escaped vs Unescaped
- Escaped (
@setting, @option, @templateOption) — HTML entities are converted. Safe for text content.
- Unescaped (
@settingRaw, @optionRaw, @templateOptionRaw) — Raw HTML is output. Use only for trusted content.
Sections
| Directive |
Description |
Example |
@sectionEnabled('location') |
Check if section is enabled |
@sectionEnabled('homepage.features') |
@hasSectionItems('location') |
Check if section has published items |
@hasSectionItems('homepage.faq') |
Shortcodes
| Directive |
Description |
Example |
@shortcodes($content) |
Process shortcodes in content |
@shortcodes($page->body) |
Authentication & Authorization
| Directive |
Description |
Example |
@authenticated ... @endauthenticated |
Content for logged-in users |
@authenticated Welcome back! @endauthenticated |
@admin ... @endadmin |
Content for admin users |
@admin <a href="/admin">Admin</a> @endadmin |
@superAdmin ... @endsuperAdmin |
Content for super admins |
@superAdmin Settings @endsuperAdmin |
@hasRole('role') ... @endhasRole |
Content for a specific role |
@hasRole('editor') Edit @endhasRole |
@hasAnyRole(['r1', 'r2']) ... @endhasAnyRole |
Content for any of listed roles |
@hasAnyRole(['admin', 'editor']) ... @endhasAnyRole |
@hasAllRoles(['r1', 'r2']) ... @endhasAllRoles |
Content for all listed roles |
@hasAllRoles(['admin', 'mod']) ... @endhasAllRoles |
@canUser('perm') ... @endcanUser |
Content for a specific permission |
@canUser('edit-posts') ... @endcanUser |
Marketing & Announcements
| Directive |
Description |
Example |
@announcement('position') |
Render announcement for a position |
@announcement('top_bar') |
@announcements |
Render all active announcements |
@announcements |
@codeSnippets('position') |
Inject code snippets for a position |
@codeSnippets('head') |
@maintenanceBanner |
Maintenance mode banner |
@maintenanceBanner |
Code Snippet Positions
| Position |
Placement |
head |
Inside <head> |
body_start |
After <body> |
body_end |
Before </body> |
Environment
| Directive |
Description |
Example |
@localhost ... @endlocalhost |
Content only on localhost |
@localhost <div>Debug Panel</div> @endlocalhost |
@production ... @endproduction |
Content only in production |
@production <!-- Analytics --> @endproduction |
Action Context
| Directive |
Description |
Example |
@editing ... @endediting |
Content when editing |
@editing <button>Update</button> @endediting |
@creating ... @endcreating |
Content when creating |
@creating <button>Create</button> @endcreating |
JSON-LD / Structured Data
| Directive |
Description |
Example |
@jsonld($data) |
Output JSON-LD script tag |
@jsonld(schema_organization()) |
Use with the schema helper functions:
@jsonld(schema_organization())
@jsonld(schema_article($post))
@jsonld(schema_breadcrumb_list($items))