The Blitz Recommendations plugin adds a utility that provides templating performance hints for Craft CMS. Recommendations for eager-loading elements are added as pages are visited.

While this plugin works seamlessly with the Blitz plugin, there is no dependency between them. In other words, this plugin can be used for free with or without Blitz. 

If you have Blitz installed, then you can uninstall the Blitz Recommendations plugin, as they essentially both provide the same hint functionality.

Blitz Hints

License #

This plugin is licensed for free under the MIT License.

Requirements #

This plugin requires Craft CMS 3.0.0 or later, or 4.0.0 or later.

Installation #

To install the plugin, search for Blitz Recommendations” in the Craft Plugin Store, or install manually using composer.

composer require putyourlightson/craft-blitz-recommendations

Usage #

Once installed, recommendations for eager-loading elements will appear in the utility for as pages are visited. A common way to visit all of the pages on the site is to use Blitz to generate the entire cache.

The plugin is able to distinguish between eager-loading opportunities for regular element queries and for elements auto-injected via route variables. The former should be prioritised and are always visible, whereas eager-loading elements on auto-injected elements is generally less critical and are hidden by default (and don’t count towards the badge total). 

{# Regular element query. #}
{% set entries = craft.entries.section('articles').all() %}

{# Element query on an entry auto-injected via route variables. #}
{% set image = entry.image.one() %}

Hints closeup

Under the hood, the Blitz and Blitz Recommendations plugins use the same logic, which has been extracted out into the Blitz Hints package.

Have a suggestion to improve the docs? Create an issue with details, and we'll do our best to integrate your ideas.