# how to implement lazy loading in hubspot pages not blog

**URL:** <https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519>\
**Category:** CMS Development\
**Created:** [July 19, 2018, 12:18pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519 "2018-07-19T12:18:53Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramanverma2005](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ramanverma2005/32/65559_2.png) [@ramanverma2005](https://community.hubspot.com/u/ramanverma2005)\
**Post date:** [July 19, 2018, 12:18pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/1 "2018-07-19T12:18:53Z")

</div>

Hi,

I want to know how to implement the lazy loading in hubspot website pages I am using .html template where image modules are implemented and read this article [Blog | 3 Simple Steps to Create Lazy Loading Images In HubSpot](https://www.bluleadz.com/blog/lazy-loading-images-on-hubspot) but this is for blog not for the website pages I want to implement in website pages only.

Thanks

---

<div class="post-metadata">

**Author:** ![Jenny](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jenny/32/24_2.png) [@Jenny](https://community.hubspot.com/u/Jenny)\
**Post date:** [August 22, 2018, 12:22pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/2 "2018-08-22T12:22:41Z")

</div>

Hey @ramanverma2005,

Are you still experiencing this issue? If so, please let me know and I can assist in getting you a solution.

If you found an answer, do you mind sharing it with the Community?

Thank you,  
Jenny

---

<div class="post-metadata">

**Author:** ![ramanverma2005](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ramanverma2005/32/65559_2.png) [@ramanverma2005](https://community.hubspot.com/u/ramanverma2005)\
**Post date:** [January 11, 2019, 8:18am UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/3 "2019-01-11T08:18:16Z")

</div>

no, lazy loading for page I did not find any solution

---

<div class="post-metadata">

**Author:** ![ravenousblue](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ravenousblue/32/52876_2.png) [@ravenousblue](https://community.hubspot.com/u/ravenousblue)\
**Post date:** [November 28, 2018, 3:46pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/4 "2018-11-28T15:46:04Z")

</div>

I am looking for a lazy loading solution for HubSpot beyond the blog. This is a Google PSI recommendation to improve mobile site speed. With the updates to PSI with LightHouse there’s more technical recommendations for speed optimization so I am looking for ways to execute in HubSpot.

---

<div class="post-metadata">

**Author:** ![Mattg1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mattg1/32/59606_2.png) [@Mattg1](https://community.hubspot.com/u/Mattg1)\
**Post date:** [January 10, 2019, 4:24pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/5 "2019-01-10T16:24:34Z")

</div>

have you found any solution to this?

---

<div class="post-metadata">

**Author:** ![BrettWright](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/brettwright/32/57633_2.png) [@BrettWright](https://community.hubspot.com/u/BrettWright)\
**Post date:** [March 4, 2019, 6:41pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/6 "2019-03-04T18:41:05Z")

</div>

Hi there,

I’ve been able to implement this only on Rich Text modules, not Image Modules. The reason for this is you need to be able to add the extra html markup to the image for the Lazy javascript to work. I haven’t found a way to target anything in an Image Module.

So put this code in your "Additional \<head\> markup:

`<script src="https://cdnjs.cloudflare.com/ajax/libs/vanilla-lazyload/8.6.0/lazyload.min.js"></script>`

And this code needs to be put in the html for **every** image (make sure to put the right URL in the 3 locations and don’t include the brackets []:

`<img src="[Your image URL]" alt="[your alt text]" width="12" style="width: 100%;" data-src="[Your image URL]?width=600 600w" data-srcset="[Your image URL]?width=600 600w">>`

---

<div class="post-metadata">

**Author:** ![nutanhaspe](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nutanhaspe/32/68963_2.png) [@nutanhaspe](https://community.hubspot.com/u/nutanhaspe)\
**Post date:** [November 12, 2019, 7:12am UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/7 "2019-11-12T07:12:07Z")

</div>

We have used above solution but here images downloaded two times, once when page load and second when we scrolll down the page.Is there a solution for this?

---

<div class="post-metadata">

**Author:** ![John](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/john/32/43512_2.png) [@John](https://community.hubspot.com/u/John)\
**Post date:** [March 13, 2019, 1:06pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/8 "2019-03-13T13:06:41Z")

</div>

Hey @ramanverma2005 , in order to implement lazy loading on your website across the board, you will have to:

- create a custom module in order to control the image’s mark up
- implement a lazy loading image js library such as [yall.js](https://github.com/malchata/yall.js) or [blazy.js.](https://github.com/dinbror/blazy)

---

<div class="post-metadata">

**Author:** ![jkeough78](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jkeough78/32/83064_2.png) [@jkeough78](https://community.hubspot.com/u/jkeough78)\
**Post date:** [October 15, 2019, 8:16pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/9 "2019-10-15T20:16:48Z")

</div>

The answer @John gave still seems to be the best/realistic option right now. Creating custom modules to handle this isn’t quick and easy. I really hope HubSpot adds lazy loading as a core feature so we don’t have to worry about it. This is important to ranking on Google.

---

<div class="post-metadata">

**Author:** ![dannio](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dannio/32/95715_2.png) [@dannio](https://community.hubspot.com/u/dannio)\
**Post date:** [November 21, 2019, 2:50am UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/10 "2019-11-21T02:50:27Z")

</div>

I think it needs a push, i.e the idea you posted to be upvoted enough for the dev team to actually pick it up:

[https://community.hubspot.com/t5/HubSpot-Ideas/Add-Lazy-Loading-as-core-feature-for-HubSpot-pages/idc-p/303339#M45852](https://community.hubspot.com/t5/HubSpot-Ideas/Add-Lazy-Loading-as-core-feature-for-HubSpot-pages/idc-p/303339#M45852)

---

<div class="post-metadata">

**Author:** ![john3211](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/john3211/32/29892_2.png) [@john3211](https://community.hubspot.com/u/john3211)\
**Post date:** [March 14, 2019, 7:58am UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/11 "2019-03-14T07:58:59Z")

</div>

i’ve been searching fot the answer long ago but couldn’t found any way to implement lazy loading in hubspot pages not blog,

---

<div class="post-metadata">

**Author:** ![chloekonig](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/chloekonig/32/27794_2.png) [@chloekonig](https://community.hubspot.com/u/chloekonig)\
**Post date:** [May 13, 2019, 2:27pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/12 "2019-05-13T14:27:41Z")

</div>

After some digging around I was finally able to to use lazy load on my website. It’s hard-coded in, so this might not be optimal, but it works for us.

First, we added this into a custom html module in our global header:

\<script type=“text/javascript” src="[https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"\>\</script](https://community.hubspot.com/)\>

Then, we added this into the footer of all pages:

\<script\> const observer = lozad(); // lazy loads elements with default selector as ‘.lozad’  
observer.observe(); \</script\>

Finally, it’s just a matter of adding the lozad class to our img tags. \<img class=“lozad” data-src=“url”…

Hope this helps!

---

<div class="post-metadata">

**Author:** ![jamesmccarthynz](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jamesmccarthynz/32/44643_2.png) [@jamesmccarthynz](https://community.hubspot.com/u/jamesmccarthynz)\
**Post date:** [April 20, 2020, 12:14am UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/13 "2020-04-20T00:14:07Z")

</div>

Hi,

I’ve done this by just creating a custom module for images.

1. Go to the design manager
2. Click _File_ → _New File_, Choose _\*Module  
  ![Screenshot 2020-04-20 at 12.07.19 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/b/8bce5e6f2ff880af78221356ea43156a168c224c.png)  
\*_
3. Tick _Pages_, Choose _Local module_, give it a name (Lazy Image), hit _Create_.
4. In your new module, click _Add field_, choose _Image_.
5. Choose a default image.
6. Click _Copy_, choose _Copy snippet._ _![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/c/4/c42c53a2362df96c7a32845d416d3b57b5acde6f.png)_
7. Paste the snippet into the module.html box

```auto
{% if module.image_field.src %}
	{% set sizeAttrs = 'width="{{ module.image_field.width }}" height="{{ module.image_field.height }}"' %}
	{% if module.image_field.size_type == 'auto' %}
		{% set sizeAttrs = 'style="max-width: 100%; height: auto;"' %}
	{% elif module.image_field.size_type == 'auto_custom_max' %}
		{% set sizeAttrs = 'width="100%" height="auto" style="max-width: {{ module.image_field.max_width }}px; max-height: {{ module.image_field.max_height }}px"' %}
	{% endif %}
	<img src="{{ module.image_field.src }}" alt="{{ module.image_field.alt }}" {{ sizeAttrs }} loading="lazy">
{% endif %}

```

1. Add the following attribute into the image, as I’ve done above.`loading="lazy"`
2. As of about Chromium 75 this is implemented in there. Replace any of the standard image modules that appear below the line with this module, update your images, alt text etc, and retest your pages.

---

<div class="post-metadata">

**Author:** ![jkeough78](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jkeough78/32/83064_2.png) [@jkeough78](https://community.hubspot.com/u/jkeough78)\
**Post date:** [April 20, 2020, 2:06pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/14 "2020-04-20T14:06:50Z")

</div>

Thanks @jamesmccarthynz ! This is really great.

I’d still like to see HubSpot integrate Lazy Loading into the pages by default so we don’t have to worry about it. In the meantime, this is a big help!

---

<div class="post-metadata">

**Author:** ![mike-ward](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike-ward/32/26595_2.png) [@mike-ward](https://community.hubspot.com/u/mike-ward)\
**Post date:** [April 20, 2020, 2:55pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/15 "2020-04-20T14:55:05Z")

</div>

Nice to see the ‘loading’ prop finally make it into the real-world!

Just a note for anyone else finding this today or in the future: as James states, it’s available in recent Chromium builds, but as of writing it’s NOT yet fully supported across all browsers (Safari on MacOS and iOS are obvious misses at this point), so if you have something that’s very image-heavy and care about those users, you may want to use another solution in the meantime.

Have a check of [caniuse.com](https://caniuse.com/#feat=loading-lazy-attr) to see latest progress. But there’s no harm doing both to be future-proofed.

It’s certainly welcome addition, anyway. Much better to use the browser-built handling than to use custom JS solutions, so I look forward to the day we can rely on browsers handling this across every platform 🙂

---

<div class="post-metadata">

**Author:** ![KundanSingh](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@KundanSingh](https://community.hubspot.com/u/KundanSingh)\
**Post date:** [February 7, 2024, 2:31pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/16 "2024-02-07T14:31:38Z")

</div>

I used the lazy loading but still my website’s speed didn’t improved and there are files of hubspot js which are impacting it

---

<div class="post-metadata">

**Author:** ![ramanverma2005](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ramanverma2005/32/65559_2.png) [@ramanverma2005](https://community.hubspot.com/u/ramanverma2005)\
**Post date:** [February 7, 2024, 3:39pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/17 "2024-02-07T15:39:50Z")

</div>

HI @KundanSingh can you share the website link so that I can check ?

---

<div class="post-metadata">

**Author:** ![John](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/john/32/43512_2.png) [@John](https://community.hubspot.com/u/John)\
**Post date:** [February 7, 2024, 2:43pm UTC](https://community.hubspot.com/t/how-to-implement-lazy-loading-in-hubspot-pages-not-blog/9519/18 "2024-02-07T14:43:58Z")

</div>

It is now 2024 and HubSpot has had this natively implemented for a while now. Hopefully a mod can mark this answer as a solution so search engines get people the correct info.
