Add <link rel='preconnect'>
, <link rel='prefetch'>
or <link rel='preload'>
resource hints to Magento 2’s head.
Features
- Tweak your Magento 2 store’s performance by adding custom
preconnect
,prefetch
andpreload
headers. - Optionally add
crossorigin
attribute. - Easily configurable at default, website and store view level (incl. sort order).
Installation
Using Composer
Installation using Composer is easy and recommended. From a terminal, just run:
composer require dan0sz/resource-hints-magento2
Manually
If you can’t or dont want to use Composer, you can click here to download the latest release of this extension and copy the contents to app/code/Dan0sz/ResourceHints
.
After installation
Developer Mode
- Run
bin/magento setup:upgrade
- Done!
Production Mode
- Run
bin/magento setup:upgrade
- Run
bin/magento setup:di:compile
- Run
bin/magento setup:static-content:deploy [locales e.g. en_US nl_NL]
- Done!
Configuration
After installation a new tab is added to Stores > Configuration > General > Web called Resource Hints. From here the preloadable resources can easily be configured, such as in the example below:

Further Reading
Download
Download the latest release of this Magento 2 extension from Github.