Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan0sz committed Jan 20, 2021
1 parent e180998 commit 870b134
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,26 @@ If you can't or dont want to use Composer, you can download the `master`-branch

After installation a new tab is added to *Stores > Configuration > General > Web* called *Resource Hints*.

#### Resource
### How does it work?

Values added to this field are assumed to be relative local assets. Their full url will be automatically resolved prior to render:
While most settings of this extension speak for themselves. The Resource column contains a few nifty tricks (thanks to @chedaroo), which will come in handy when e.g. Static content signing is enabled.

- `Vendor_Module::path/to/asset.ext` (local)
- `path/to/asset.ext` (local)
Values in the Resource column are assumed to be relative (local) assets. When a relative path is entered and **Static Content Signing** is **enabled**, e.g.

Because of this, remote assets **must** be prefixed with a protocol:
- `http://domain.tld/path/to/asset.ext` (remote)
- `https://domain.tld/path/to/asset.ext` (remote)
- `//SomeVolume/path/to/asset.ext` (remote)
(*In these examples it is assumed that the default theme, Magento Luma is used.*)

- `YourName_ModuleName::path/to/file.ext` will resolve to `https://yourdomain.tld/static/<<deployment_version>>/frontend/Magento/luma/en_US/YourName_ModuleName/path/to/file.ext`, and
- `path/to/file.ext` will resolve to `https://yourdomain.tld/static/<<deployment_version>>/frontend/Magento/luma/en_US/path/to/file.ext`.

When **Static Content Signing** is **disabled**, the above mentioned values will resolve to:

- `https://yourdomain.tld/static/frontend/Magento/luma/en_US/YourName_ModuleName/path/to/file.ext`, and
- `https://yourdomain.tld/static/frontend/Magento/luma/en_US/path/to/file.ext` respectively.

When absolute URLs (prefixed by a protocol, i.e. `http://`, `https://` or `//`) are entered in the Resource column, no prior resolving will take place. E.g.

- `http://yourdomain.tld/path/to/file.ext`,
- `https://yourdomain.tld/path/to/file.ext`, and
- `//SomeVolume/path/to/file.ext`.

The examples above will all resolve to the same exact URL.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dan0sz/resource-hints-magento2",
"description": "Add `<link rel='preconnect'>`, `<link rel='prefetch'>` or `<link rel='preload'>` resource hints to Magento 2's head.",
"version": "1.1.0",
"version": "1.2.0",
"require": {
"php": "7.*",
"ext-openssl": "*",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Dan0sz_ResourceHints" setup_version="1.1.0">
<module name="Dan0sz_ResourceHints" setup_version="1.2.0">
<sequence>
<module name="Magento_Catalog" />
</sequence>
Expand Down

0 comments on commit 870b134

Please sign in to comment.