Blog, Website & Page Publishing

thepankajkumar
Participant

how to add lazy load to Blog RSS feed Hubspot blog post?

Résolue

We have been getting SEO Performance Issue (Load Time), In the blog section, we have right hand side, Blog RSS Feed where we are trying to show Top 5 Popular post. Those RSS feed has a image with title. And I want to apply lazy load to it. Is it possible to apply lazy load to RSS Feed? If yes, then How?

0 Votes
1 Solution acceptée
Anton
Solution
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

how to add lazy load to Blog RSS feed Hubspot blog post?

Résolue

Hi @thepankajkumar

 

to get it right - when talking about "RSS" you're talking about the blog listing page, right?

 

If so - it's possible. 

 

There are several places you should look for the top 5 posts. 

1. Blog listing template

2. If the "Top 5" is a custom module then you should look for the custom module

 

The code you're looking for looks something like this(a very basic example)

{% for recent_post in recent_posts %}
<img src="{{recent_post.featured_image.src}}" alt="{{recent_post.featured_image.alt}}">
<h3>{{recent_post.name}}</h3>
{% endfor %}

 

Add

loading="lazy"

 to the image-tag so the whole code should look something like this

{% for recent_post in recent_posts %}
<img src="{{recent_post.featured_image.src}}" alt="{{recent_post.featured_image.alt}}" loading="lazy" >
<h3>{{recent_post.name}}</h3>
{% endfor %}

 

 

If you'd like to go the JavaScriptp route - here's a guide for lazy loading images. But this can have a negative impact on speed.

 

 

hope this helps

 

best, 

Anton

 

Anton Bujanowski Signature

Voir la solution dans l'envoi d'origine

5 Réponses
Anton
Solution
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

how to add lazy load to Blog RSS feed Hubspot blog post?

Résolue

Hi @thepankajkumar

 

to get it right - when talking about "RSS" you're talking about the blog listing page, right?

 

If so - it's possible. 

 

There are several places you should look for the top 5 posts. 

1. Blog listing template

2. If the "Top 5" is a custom module then you should look for the custom module

 

The code you're looking for looks something like this(a very basic example)

{% for recent_post in recent_posts %}
<img src="{{recent_post.featured_image.src}}" alt="{{recent_post.featured_image.alt}}">
<h3>{{recent_post.name}}</h3>
{% endfor %}

 

Add

loading="lazy"

 to the image-tag so the whole code should look something like this

{% for recent_post in recent_posts %}
<img src="{{recent_post.featured_image.src}}" alt="{{recent_post.featured_image.alt}}" loading="lazy" >
<h3>{{recent_post.name}}</h3>
{% endfor %}

 

 

If you'd like to go the JavaScriptp route - here's a guide for lazy loading images. But this can have a negative impact on speed.

 

 

hope this helps

 

best, 

Anton

 

Anton Bujanowski Signature
thepankajkumar
Participant

how to add lazy load to Blog RSS feed Hubspot blog post?

Résolue

Thank you Anton,

 

I would also like to know how to add this code in the predefined RSS Listing module [Blog Post Template]. 

 

0 Votes
Anton
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

how to add lazy load to Blog RSS feed Hubspot blog post?

Résolue

You're welcome @thepankajkumar

since the Blog post Content is a single "rich-text" you can add this by

1. JavaScript/jQuery (most likely the easiest way to go)

2. set it individually on each image in the content (select image -> click on "pen"-icon -> advanced)

3. Adding 'loading="lazy"' to each image via Source-code edit (I don't recommend this)

4. Coding a custom blog post module with several options (very advanced)

 

 

best, 

Anton

Anton Bujanowski Signature
Teun
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

how to add lazy load to Blog RSS feed Hubspot blog post?

Résolue

Hi @thepankajkumar ,

 

I suppose you do control the HTML? Here is a great guide on how to implement lazyloading.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


TiphaineCuisset
Gestionnaire de communauté
Gestionnaire de communauté

how to add lazy load to Blog RSS feed Hubspot blog post?

Résolue

Hi @thepankajkumar 

 

Thank you for reaching out.

 

I want to tag some of our experts here - @Teun @Anton do you have any thought for @thepankajkumar on this? 

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !