Follow these tips to improve loading times and Core Web Vitals scores.
image_url filterimage_url to generate fast, responsive, modern images without changing your original assets.image_url to serve AVIF/WebP images, control quality, and generate multiple sizes on the fly.image_url filter is a macro built into the Vitrin theme SDK. It lets you:srcset, etc.)image_url(path, w=None, h=None, q=None, f=None)path (required) – URL or path to the original imagew – Output width in pixelsh – Output height in pixelsq – Output quality from 0 to 100f – Output format. Use 'auto' to let the client’s browser choose the best supported format (recommended){{ image_url(ny_image, w=400, q=85, f='auto') }}srcset example{{ image_url(...) }} in your templates.q (e.g. q=70) to balance visual quality and performance, especially for mobile.srcset so images stay sharp on all screen sizes.<head> section:<link rel="preload" as="image"
href="{{ image_url(logoUrl, h=175, q=100) }}"
media="(min-width: 992px)">
{% if logoUrlMobile %}
<link rel="preload" as="image"
href="{{ image_url(logoUrlMobile, h=175, q=100) }}"
media="(max-width: 991px)">
{% else %}
<link rel="preload" as="image"
href="{{ image_url(logoUrl, h=175, q=100) }}"
media="(max-width: 991px)">
{% endif %}media attribute specifies the viewport size that triggers the preloading.logoUrlMobile is not defined.async for scripts that don’t require order.defer for scripts that require order but should not block rendering:srcset to serve the right size based on device: