Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi. I am trying to reach a 2.5 LCP score on my store https://guayaberascab.com .I have come to the conclusion that lazysizes is adding time to my LCP so I want to disable it only on my hero. I deleted LAZYLOAD class but the image stops from loading. Any suggestions about this or other suggestions to improve my LCP?
<div class="hero hero--{{ section.settings.hero_size }} hero-{{ section.id }}{% if section.settings.title != blank or section.settings.text != blank or section.settings.button_label != blank %} hero__overlay{% endif %} box ratio-container lazyload js"
id="Hero-{{ section.id }}"
data-layout="{{ section.settings.hero_layout }}"
{%- if section.settings.image -%}
{% unless section.settings.image.alt == blank %}
role="img"
aria-label="{{ section.settings.image.alt | escape }}"
data-alt="{{ section.settings.image.alt | escape }}"
{% endunless %}
data-bg="{{ section.settings.image | img_url: '300x300' }}"
data-bgset="{% include 'bgset', image: section.settings.image %}"
data-sizes="auto"
data-parent-fit="cover"
style="background-position: {{ section.settings.alignment }};"
data-image-loading-animation
{%- endif -%}>
{%- if section.settings.image == blank -%}
<div class="placeholder-background">
{{ 'lifestyle-1' | placeholder_svg_tag: 'placeholder-svg' }}
</div>
{%- endif -%}
<div class="hero__inner">
<div class="page-width text-center">
{%- if section.settings.title != blank -%}
<h2 class="h1 mega-title{% if section.settings.text_size == 'large' %} mega-title--large{% endif %}">{{ section.settings.title | escape }}</h2>
{%- endif -%}
{%- if section.settings.text != blank -%}
<div class="rte-setting mega-subtitle{% if section.settings.text_size == 'large' %} mega-subtitle--large{% endif %}">{{ section.settings.text }}</div>
{%- endif -%}
{%- if section.settings.button_label != blank and section.settings.button_link != blank -%}
{%- capture ariaLabel -%}
{{- section.settings.button_label -}}
{%- if section.settings.button_link.type == 'frontpage_link' -%}
: {{ 'homepage.general.title' | t -}}
{%- elsif section.settings.button_link.type == 'catalog_link' -%}
: {{ 'collections.catalog.title' | t -}}
{%- elsif section.settings.button_link.object.title -%}
: {{ section.settings.button_link.object.title -}}
{%- endif -%}
{%- endcapture -%}
<a href="{{ section.settings.button_link }}"
class="btn hero__btn"
aria-label="{{ ariaLabel }}">
{{- section.settings.button_label | escape -}}
</a>
{%- endif -%}
</div>
</div>
</div>
Solved! Go to the solution
This is an accepted solution.
Hi Cabpj,
Welcome to Shopify Community.
Aibek is here from Growavelabs Agency: https://growavelabs.com/
You need to delete data-bg и data-bgset. Then you need to add in styles background-image: url("{{ section.settings.image | img_url: 'master' }}").
Instead of a master, you can prescribe the size of the picture. In general, this is how it should look for the pictures to be displayed:
<div class="hero hero--{{ section.settings.hero_size }} hero-{{ section.id }}{% if section.settings.title != blank or section.settings.text != blank or section.settings.button_label != blank %} hero__overlay{% endif %} box ratio-container lazyload js" id="Hero-{{ section.id }}" data-layout="{{ section.settings.hero_layout }}" {%- if section.settings.image -%} {% unless section.settings.image.alt == blank %} role="img" aria-label="{{ section.settings.image.alt | escape }}" data-alt="{{ section.settings.image.alt | escape }}" {% endunless %} data-sizes="auto" data-parent-fit="cover" style="background-image: url("{{ section.settings.image | img_url: 'master' }}"); background-repeat: no-repeat; background-position: {{ section.settings.alignment }};" data-image-loading-animation {%- endif -%}> {%- if section.settings.image == blank -%} <div class="placeholder-background"> {{ 'lifestyle-1' | placeholder_svg_tag: 'placeholder-svg' }} </div> {%- endif -%} <div class="hero__inner"> <div class="page-width text-center"> {%- if section.settings.title != blank -%} <h2 class="h1 mega-title{% if section.settings.text_size == 'large' %} mega-title--large{% endif %}">{{ section.settings.title | escape }}</h2> {%- endif -%} {%- if section.settings.text != blank -%} <div class="rte-setting mega-subtitle{% if section.settings.text_size == 'large' %} mega-subtitle--large{% endif %}">{{ section.settings.text }}</div> {%- endif -%} {%- if section.settings.button_label != blank and section.settings.button_link != blank -%} {%- capture ariaLabel -%} {{- section.settings.button_label -}} {%- if section.settings.button_link.type == 'frontpage_link' -%} : {{ 'homepage.general.title' | t -}} {%- elsif section.settings.button_link.type == 'catalog_link' -%} : {{ 'collections.catalog.title' | t -}} {%- elsif section.settings.button_link.object.title -%} : {{ section.settings.button_link.object.title -}} {%- endif -%} {%- endcapture -%} <a href="{{ section.settings.button_link }}" class="btn hero__btn" aria-label="{{ ariaLabel }}"> {{- section.settings.button_label | escape -}} </a> {%- endif -%} </div> </div> </div>
This may helps you with your problem.
Also, if you wish our agency can help you with Speed Optimisation. Do not hesitate send me a message here: hello@growavelabs.com
Best Regards,
Aibek
This is an accepted solution.
Hi Cabpj,
Welcome to Shopify Community.
Aibek is here from Growavelabs Agency: https://growavelabs.com/
You need to delete data-bg и data-bgset. Then you need to add in styles background-image: url("{{ section.settings.image | img_url: 'master' }}").
Instead of a master, you can prescribe the size of the picture. In general, this is how it should look for the pictures to be displayed:
<div class="hero hero--{{ section.settings.hero_size }} hero-{{ section.id }}{% if section.settings.title != blank or section.settings.text != blank or section.settings.button_label != blank %} hero__overlay{% endif %} box ratio-container lazyload js" id="Hero-{{ section.id }}" data-layout="{{ section.settings.hero_layout }}" {%- if section.settings.image -%} {% unless section.settings.image.alt == blank %} role="img" aria-label="{{ section.settings.image.alt | escape }}" data-alt="{{ section.settings.image.alt | escape }}" {% endunless %} data-sizes="auto" data-parent-fit="cover" style="background-image: url("{{ section.settings.image | img_url: 'master' }}"); background-repeat: no-repeat; background-position: {{ section.settings.alignment }};" data-image-loading-animation {%- endif -%}> {%- if section.settings.image == blank -%} <div class="placeholder-background"> {{ 'lifestyle-1' | placeholder_svg_tag: 'placeholder-svg' }} </div> {%- endif -%} <div class="hero__inner"> <div class="page-width text-center"> {%- if section.settings.title != blank -%} <h2 class="h1 mega-title{% if section.settings.text_size == 'large' %} mega-title--large{% endif %}">{{ section.settings.title | escape }}</h2> {%- endif -%} {%- if section.settings.text != blank -%} <div class="rte-setting mega-subtitle{% if section.settings.text_size == 'large' %} mega-subtitle--large{% endif %}">{{ section.settings.text }}</div> {%- endif -%} {%- if section.settings.button_label != blank and section.settings.button_link != blank -%} {%- capture ariaLabel -%} {{- section.settings.button_label -}} {%- if section.settings.button_link.type == 'frontpage_link' -%} : {{ 'homepage.general.title' | t -}} {%- elsif section.settings.button_link.type == 'catalog_link' -%} : {{ 'collections.catalog.title' | t -}} {%- elsif section.settings.button_link.object.title -%} : {{ section.settings.button_link.object.title -}} {%- endif -%} {%- endcapture -%} <a href="{{ section.settings.button_link }}" class="btn hero__btn" aria-label="{{ ariaLabel }}"> {{- section.settings.button_label | escape -}} </a> {%- endif -%} </div> </div> </div>
This may helps you with your problem.
Also, if you wish our agency can help you with Speed Optimisation. Do not hesitate send me a message here: hello@growavelabs.com
Best Regards,
Aibek
It worked,but without " "
background-image: url({{ section.settings.image | img_url: 'master' }})
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025