Hola! ¡Tenemos nuestra Comunidad en Español!

RSS feed and HubL

SOLVE
Anonymous

Does anybody know the corred script/format is to use an RSS blog listing in an email?

 

In the code I have " {% rss_listing "rss_listing" %} " but it renders strangely in the email (I can't change the width, font colour etc). Does anyone know how I can format this? I feel like it should be like html coding, but my trial and error isn't working.

1 Accepted solution

Accepted Solutions
Regular Contributor | Platinum Partner

Hi!

Thanks @roisinkirby Smiley Happy.

I haven't worked too much with emails but I can imagine that you can't edit the HTML output from the RSS module. You can add custom CSS to improve the design but this isn't the best way because a lot of email readers (gmail for example) don't use classes, just inline-style.

 

So my advice is to use HubL functions (instead of modules) to manage the HTML output and the CSS at the same time. For example:

{% set posts = blog_recent_posts('default', 5) %}
<table style="width:100%;border:1px solid;padding:2rem;background:#c1c1c1;color:#666;"> {% for post in posts %} <tr>
<h2><a href="{{post.absolute_url}}" style="font-size:1.5rem;color:#666">
{{ post.name }}</a><h2>
<div>{{post.summary}}</div>
</tr>
{% endfor %}
</table>
 

 More documentation here.

You can insert this directly in the content block, but usually I like to have everything ordered so you can add a HubL block to your template and customize your code there Smiley Wink

 


I hope this could help you! Smiley Happy

Regards,
Gonzalo

6 Replies
Community Manager

Hey @Gonzalo is this something you've come across before? I've noticed you've had some great contributions r.e. HubL. I'll also follow up with designers on HubSpot's side @Anonymous Smiley Happy

Reply
0 Upvotes
Regular Contributor | Platinum Partner

Hi!

Thanks @roisinkirby Smiley Happy.

I haven't worked too much with emails but I can imagine that you can't edit the HTML output from the RSS module. You can add custom CSS to improve the design but this isn't the best way because a lot of email readers (gmail for example) don't use classes, just inline-style.

 

So my advice is to use HubL functions (instead of modules) to manage the HTML output and the CSS at the same time. For example:

{% set posts = blog_recent_posts('default', 5) %}
<table style="width:100%;border:1px solid;padding:2rem;background:#c1c1c1;color:#666;"> {% for post in posts %} <tr>
<h2><a href="{{post.absolute_url}}" style="font-size:1.5rem;color:#666">
{{ post.name }}</a><h2>
<div>{{post.summary}}</div>
</tr>
{% endfor %}
</table>
 

 More documentation here.

You can insert this directly in the content block, but usually I like to have everything ordered so you can add a HubL block to your template and customize your code there Smiley Wink

 


I hope this could help you! Smiley Happy

Regards,
Gonzalo

Anonymous

Super helpful for my colleague - thank you @Gonzalo. You've had some great insights on this forum Smiley Happy

Highlighted
New Contributor

Hi @Gonzalo,

 

I'm also trying to do this but I'm not getting it to work. Like aoifemoon, I also tried {% rss_listing "rss_listing" %}. That worked but I was unable to rearrange content how I want it. I'm trying to add an external RSS feed to a custom module so I can place it into a Drag-and-Drop email template.

I've tried blog_recent_posts() using your example and it worked for Hubspot blogs but I have an external RSS feed. Do you know if this function works with external RSS feeds?

Thanks!

Reply
0 Upvotes
Regular Contributor | Platinum Partner

Hey @KeithMon,
I don't think blog_recent_posts works with external blogs (just hubspot hosted).


So the only solution I have find out and we use for our clients is use the default RSS function, and customize the external RSS with the right marktup that you want to us (because I don't think you can edit the RSS marktup content within HubL).

 

In my case, we have setup in our server a service where we have some posibilities to customize the RSS in may ways, then it output the right marktup for the HS RSS reader. But of course is a premium service to offer to the clients, and not all of them want it.

New Contributor

That's what I was afraid of. Thanks for the info. 

Reply
0 Upvotes