Page Templates
Textstem pages are rendered with Blade templates in resources/views/wrangler/pages/. Every .blade.php file there is offered as a template in the page editor, named after the file (landing.blade.php → landing).
A page renders with wrangler.pages.{template} from the host app. If that doesn't exist, the package's template of the same name is used, and then the package's default.
Regions
A template marks where blocks go with <region> elements. Each region's name is a slot editors can put blocks in; the page builder finds them by reading the template file:
<x-textstem::public-layout>
<region name="hero">
@foreach($components['hero'] ?? [] as $pageComponent)
{!! $pageComponent !!}
@endforeach
</region>
<main>
<region name="main">
@foreach($components['main'] ?? [] as $pageComponent)
{!! $pageComponent !!}
@endforeach
</region>
</main>
</x-textstem::public-layout>
$components holds each slot's rendered blocks, and always has hero, main and aside keys.
What templates can use
Besides $components, the renderer shares these with every view on the page:
| Variable | Holds |
|---|---|
$page |
The WranglerPage being shown |
$globals |
The site's globals, keyed by name |
$user |
The signed-in user, or null |
$context |
The page context used by template commands |
$edit_url |
The page's admin edit link |
$adminbar, $helpersEnabled, $helpersOn |
Admin bar state (see The Default Tool Bar) |
Textstem::sectionMenu($page) returns the menu for the page's section, as used by the package's default template.
Semantic Markup
Using semantic markup in HTML is important for several reasons, ranging from accessibility and SEO to maintainability and collaboration. It also helps Textstem's AI helpers write page descriptions and keywords: put the main content in a <main> element or an element with role="main".