Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {# v1 #}
- {# settings #}
- {% set faviconFileName = '/static/images/favicon.jpg' %}
- {% set sizesIcon = [192, 48, 32, 16] %}
- {% set sizesAppleTouch = [180] %}
- {# output #}
- {% if craft.app.plugins.isPluginEnabled('imager') and craft.imager.transformImage(faviconFileName, {}, null, {suppressExceptions : true}) %}
- {% for faviconSize in sizesIcon %}
- {% set faviconTransform = {
- width: faviconSize,
- height: faviconSize,
- quality: 100,
- position: 'center-center',
- format: 'png',
- } %}
- {{tag('link', {
- rel: 'icon',
- sizes: faviconSize ~ 'x' ~ faviconSize,
- type: 'image/png',
- href: craft.imager.transformImage(faviconFileName, faviconTransform, null, {suppressExceptions : true}),
- })}}
- {% endfor %}
- {# link touch icon #}
- {% for faviconSize in sizesAppleTouch %}
- {% set faviconTransform = {
- width: faviconSize,
- height: faviconSize,
- quality: 100,
- position: 'center-center',
- format: 'png',
- } %}
- {{tag('link', {
- rel: 'apple-touch-icon',
- sizes: faviconSize ~ 'x' ~ faviconSize,
- href: craft.imager.transformImage(faviconFileName, faviconTransform, null, {suppressExceptions : true}),
- })}}
- {% endfor %}
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement