The Top Five Craft 5 Features I'm Excited About
Craft 5 is now in beta! There are five features in particular that I think will change the game for authors and developers.
Craft 5 has been in development for some time, but as of February 8, 2024, it’s now in beta! That milestone makes it a great time to take a look at what’s new and improved, especially as authors and developers. There are new features that will change the way you model your content, author new content, and develop your templates. While there are many new things on the way, here are the top five features I’m most excited for:
1. A fresh coat of paint
Craft 5 includes a refreshed control panel that brings a lighter and friendlier feel to your content editing. You’ll notice this change right away. Almost every screen has been redesigned to be cleaner and more focused.
The sidebar is now collapsible and ultra widescreen support has also been improved with a new max-width set on the content area. Breadcrumbs include new inline actions (making them more functional than before) and now enable you to not only return to entries from the current section, but browse to another directly — without having to go back to the entries screen first.
The element editor slideout has also been overhauled, now allowing inline entry type and field creation. I can’t begin to describe what a game changer this is. If you’ve ever modeled content in Craft, you know what it’s like to start adding a new section only to realize you forgot to create a field you need first. Now you can just keep building and adding things right on the same screen. It’s easier than ever to keep moving forward and making changes and improvements as you need them.
2. Matrix in Matrix
It’s not exactly a nested matrix field within a matrix, but better — in my opinion. Craft 5 now allows you to create entry types to use instead of a non-reusable block type within a Matrix field. The entry type you create can even have a matrix field within it. This means that blocks now use the same fields as other entry types. No longer do you have to create ‘throwaway’ fields for your Matrix blocks. Craft 5 also lets you reuse fields and repurpose them - you can now override the field label and the field handle. This means you can take that simple text field you created and reuse it in a Matrix block for an author bio and rename the field to ‘Author Bio’ for just that one entry type. But under the hood, it’s using the ‘text’ field you created. Pretty nice, huh? In addition, entry types are now decoupled from sections so they can be used across multiple sections, Matrix fields, and CKEditor fields.
3. Field and Entry Type usage reports
Previously, if you wanted to see what entries were using a field, you had to rely on a plugin or write a query to get the info directly from the database. Craft 5 includes a handy feature that brings that information right into the edit screen for field and entry types. Taking inventory of your fields and entry types is only a click away! This can be really useful for site owners to know how authors are using their tools. Is everyone using that new stylized header block, or are they still using the old one? Or, if you’re redesigning your site, you can now easily do an audit to know what fields or entry types are the most popular and only port over the ones that are essential. The data has always been there, but now it’s surfaced for you.
4. Thumbnails and icons and colors, oh my!
Craft 5 makes it quicker to find what you’re looking for by making a few UI enhancements. You can now add an icon and color to element types. This changes the way the element is displayed in its various states: cards, chips, inline matrix blocks. You can also specify an asset field as an entry’s thumbnail to use in the cards and chips wherever that entry appears. All of these improvements make for a beautiful, more organized content editing experience. I can’t wait to color code some of our clients' page builder Matrix fields. I can just imagine how organized and clear it will be once we can add an icon to know what type of field it is, or add colors based on things like whether a block is flexible (can be added to columns) or inflexible (locked to full-width). I can see this being really helpful to authors and even developers.
5. Lazy eager-loading #
Last but not least is a feature developers will love! Craft 5 allows lazy eager-loading of nested elements. Previously, this seemed like just a tough thing to get right or even remember to do. You had to remember to update your with()
portion of your element query with any changes you added further down in the template. Now your workflow can be done inline (there’s clearly a theme with this Craft release). Simply add .eagerly()
to your nested element query and that's it. Craft will handle the rest! You can still use .with()
if you'd like to specify everything up front, but it's even easier to make sure your nested elements are eager-loaded.
Here is a quick example of how it was previously done and how you can now eager load elements as you get to them:
{# Craft 4 method using .with() #}
{% set entries = craft.entries()
.section('news')
.with(['assetsField'])
.all() %}
{% for entry in entries %}
{% set image = entry.assetsField[0] ?? null %}
{% if image %}
<img src="{{ image.url }}" alt="{{ image.title }}">
{% endif %}
{% endfor %}
{# Craft 5's new lazy eager-loading with .eagerly() #}
{% set entries = craft.entries()
.section('news')
.all() %}
{% for entry in entries %}
{% set image = entry.assetsField.eagerly().one() ?? null %}
{% if image %}
<img src="{{ image.url }}" alt="{{ image.title }}">
{% endif %}
{% endfor %}
While these are my favorite upcoming changes, there’s plenty more to be excited about in the upcoming version of Craft. What feature are you most excited for? Will you be color coding your site from top to bottom? Adding thumbnails to all those entry relational fields? Or will you be doing a deep dive into converting all of your Matrix blocks to entry types? I can’t wait to see what possibilities will come from the release of Craft 5! Be sure to follow the announcements at craftcms.com and keep an eye on our blog for more upcoming features!