Skip to content
Guide

Antlers or Blade for Statamic sites

Statamic has supported Blade for years, and some developers now build whole sites with it. Before you switch a team or a project, it helps to know where each one is stronger, and what Statamic 6 is about to change.

· Updated · 5 min read · Thomas Sausen

Why the question comes up now

In December, Marty Friedel of Mity Digital explained why he is switching to Blade for his Statamic sites. His reasons are specific. He works in PhpStorm, where Antlers has no up-to-date support for highlighting, autocompletion, or formatting. His team builds more and more with Livewire and Alpine, and Blade lets them stay in one templating language across Laravel apps and Statamic sites. Blade components also live in Laravel's usual folders, while an Antlers partial like a button couldn't simply be reused inside a Livewire component. And Laravel developers who join the team already know Blade.

Marty makes clear that this fits his work and not necessarily yours, and he still calls Antlers excellent. So the question for your own sites is which of his reasons apply to you. Statamic's documentation now shows its examples in both Antlers and Blade, so either path is well supported.

What Antlers does well

Antlers is built around Statamic's content. A template automatically gets the page's data, and tags fetch collections, navigation, and forms. A blog listing that would need a controller and a query in plain Laravel takes a few lines of template in Antlers. On top of that come more than 150 modifiers that transform values inline with a pipe. Marty calls them the one thing he'll miss, since they're simply nicer to write than their Blade equivalents.

The cascade helps too. Page data, globals, and system variables are available in every Antlers template and partial, with no wiring. In Blade, they're available in the main template, but components don't get them by default, so you either pass the data in or use the @cascade directive. For sites where the content structure lives in Statamic and the templates mainly display it, Antlers means less code to write and maintain.

What Blade does well

Blade's strength is that it's plain Laravel. Laravel developers already know it, and IDEs support it well. Helpers like Str and Arr are available without extra steps. Components and Livewire fit in directly, and a view can be shared between a Statamic site and the rest of a Laravel app.

Statamic's Blade support covers most of what Antlers does. Tags are available as components, for example <s:collection from="pages">, or through a fluent Statamic::tag() call, and modifiers through Statamic::modify(). A few things work differently. Blade escapes output by default and Antlers doesn't. Antlers' loop variables like first and count are replaced by Laravel's $loop. And Blade templates use @extends instead of Statamic's layout wrapping.

Here's the same listing in both, the three latest blog posts with a formatted date and a shortened excerpt.

In Antlers:

{{ collection:blog limit="3" sort="date:desc" }}
    <article>
        <h2><a href="{{ url }}">{{ title }}</a></h2>
        <time>{{ date format="j F Y" }}</time>
        <p>{{ excerpt | truncate:120 }}</p>
    </article>
{{ /collection:blog }}

And in Blade:

<s:collection from="blog" limit="3" sort="date:desc">
    <article>
        <h2><a href="{{ $url }}">{{ $title }}</a></h2>
        <time>{{ Statamic::modify($date)->format('j F Y') }}</time>
        <p>{{ Statamic::modify($excerpt)->truncate(120) }}</p>
    </article>
</s:collection>

The structure is almost identical, and neither needs a controller. The difference is in the details: variables need a dollar sign, and modifiers turn into method calls. In a template with many formatted values, that adds up. If you prefer a more typical Laravel style, the same loop also works with @foreach and a fluent Statamic::tag('collection:blog') call.

What Statamic 6 changes

Statamic 6, which is close to release, narrows the gap from the Antlers side. In #11799, John Koster gave Antlers the same tag-component syntax Blade already had. More important is #12424, also by John: Antlers templates can render Blade components directly, so a card component like <x-card :$title /> works inside an Antlers loop. Antlers can even be used to write Blade components, with @props and @aware.

That removes one practical reason to choose Blade for a whole site. A button built as a Blade component can now serve Antlers templates and Livewire alike, so a team can use Livewire where it helps without giving up Antlers everywhere else.

Which one to choose

I'd decide by team rather than by taste. If your team spends most of its time in Laravel apps or builds with Livewire, Blade keeps everyone in one templating language and removes a lot of friction. If your sites are content-driven, the templates mostly display entries, and the people writing them aren't full-time Laravel developers, Antlers gets you there with less code.

For existing sites, I wouldn't switch just because Blade is well supported now. Rewriting templates that work costs time and adds risk without any visible gain for the client. New projects are the natural place to decide. Mixing is possible too, since an Antlers site can include Blade views as partials, and with Statamic 6 it can share components with them.

Sources

Author

Thomas Sausen is a freelance web developer and the editor of Flatbard. He builds with Statamic and writes about the surrounding ecosystem.