Solved

Dynamic content in an email pointing at "Newest Blog Post"


Userlevel 2
Badge +7
  • Active Contributor IV
  • 26 replies

I am working on building a re-engagement flow that will send an email template that dynamically pulls the name, image, blurb, and URL of the latest blog posted on our website.

I know Klaviyo can pull products into an email dynamically - but can I o the same for our blog pages, How would I tag these pages for Klaviyo to “see” them and how can I keep them differentiated from the actual products that we have triggers around?

 

Thank you

icon

Best answer by Spark Bridge Digital LLC 10 May 2023, 22:47

View original

13 replies

Userlevel 6
Badge +31

Hey there!

There is a way to pull in your Blog RSS feed into your emails. Here is a detailed overview of the steps you’ll take to get it added in! https://help.klaviyo.com/hc/en-us/articles/115005258768

I do not believe you can make it dynamic to the user’s prior history with your brand, like what they’ve seen before but it’ll at least be a updating feed placed into the emails!

Userlevel 2
Badge +7

Thank you!

This is perfect and exactly what I was looking for.

I am having a bit of trouble in testing it though, using the guide and the link that Klaviyo provides as there are no images in that link I cannot test how it would render, also many of the liquid filters I’m trying to apply to it in the variable fields are not working great (like pulling in the htmlurl or trying to strip_html from the Body field)

Does anyone have a more robust JSON URL I can use for testing - (so I can get proof of concept before I brief our web team to rebuild our blog in this format)

Thank you :)

Badge +2

Hello,

I’m working on using an RSS feed and I’m having some issue with rendering the content.  Using this article: https://help.klaviyo.com/hc/en-us/articles/115005258768 I have it setup and working except for the feed displays HTML for ITEM output.

Title displays fine it’s just the content for the ITEMs display in HTML, see image.

I know it’s something simple but I just can’t fine the coding snippet to make it display correctly.

Badge +2

Hello,

I’m working on using an RSS feed and I’m having some issue with rendering the content.  Using this article: https://help.klaviyo.com/hc/en-us/articles/115005258768 I have it setup and working except for the feed displays HTML for ITEM output.

Title displays fine it’s just the content for the ITEMs display in HTML, see image.

I know it’s something simple but I just can’t fine the coding snippet to make it display correctly.

 

Userlevel 2
Badge +7

I was having the same issues and found using the striptags filter works

{{ item.body | striptags | truncatechars:250 }}

 

Some of these fields don’t return any values though:

This is the data:

As you can see the URL just gives me the JSON code and is not something I would want recipients to click on - I would want them to click on the “htmlUrl” to give them a clickable link…. but that field/variable does not want to populate - I cannot tell the difference about how one field will or wont work?

Also this sample data link does not have any images embedded to test with.

 

So if anyone has a JASON link and data that they don’t mind sharing for testing and mapping purposes that be great :)  

Badge +2

@dgibbs I knew it would be a simple tag issue, Thank you!

Now the real feed I’m trying to get working is from the National Hurricane Center (https://www.nhc.noaa.gov/aboutrss.shtml )  Most of the RSS feeds are about the same for the most part but this is the main one ( Graphical Tropical Weather Outlooks: https://www.nhc.noaa.gov/gtwo.xml )  It has links and images so this is a good one to get working.
 

I was able to display content by adding your filter suggestion “|striptags”  but I’m still missing info from the feed.
 

I hard coded the top Image, but would like to pull that in dynamically from the feed.  Also in the feed are images I’d like to display also, any ideas?

I have the same RSS setup in Mailchimp and it just works, all I had to do is enter the rss feed and it did the rest and worked perfectly. (below)
 

 

Userlevel 2
Badge +7

@EMail1Dude 

Im, trying to use the link you shared (https://www.nhc.noaa.gov/gtwo.xml) and I cant even get the template to see it. What are you using for the Content Repeat rules and for your variables?

 

didn’t work

None of these worked either
 

even plugging all the data and klaviyo instructions into ChatGPT and asking for specific steps and code suggestions were not able to get it to work for me!

Badge +2

@dgibbs I know, this is a lot more involved to setup an RSS feed than I thought it would be, but getting through it little by little as there is not much info on the web on coding/syntax etc..  With that said I was able to get some of it to display, see below.

 

The “Repeat for” is feeds.NHC_Graphical_Tropical_Weather_Outlooks.rss.channel.item|slice:':+1'

Hope that helps @dgibbs so you can figure it out! :-)

Soooo, once we figure this out the next step is to setup a flow, BUT only send it when the RSS feed is updated. :-)

Userlevel 2
Badge +7

@EMail1Dude Thanks - Will keep tinkering and testing and sharing what I find :)

@Community - Is there a limit to the number of Web feeds you can have in an account, using the same code and settup did not work from me until after I deleted the other webflow - making no other changes, it started to work?

Badge +2

@dgibbs Thank you!  As for limit of feeds, I’m not sure but I have a lot of them, BUT non of them are “actively” being used so not sure if Active vs Inactive makes a difference.

 

Here is a list of the feeds I’ve setup for usage once we figure out how to implement.

Userlevel 2
Badge +7

Maybe make a unique alias for each of them? that may have been what was holding me back?

Badge +2

SIDE NOTE: you can use this site to see a feed displayed in HTML.

https://rss.bloople.net/?url=https://www.nhc.noaa.gov/gtwo.xml  just replace the feed as needed to see a full rendered output.

https://rss.bloople.net/?url=ADD-FEED-URL-HERE

 

 



 

Badge +2

This feed also: https://www.nhc.noaa.gov/gtwo.xml  I noticed it has a <![CDATA[ tag - is there a filter to render this?  The ...|stiptags work but only shows text and not images.

I found a snippet of code that almost works to display an image, the image will not show up but it does add the correct link to the image.

<div>{% for item in feeds.NHC_Graphical_Tropical_Weather_Outlooks.rss.channel.item|slice:":+1" %}
<table style="display: inline-block; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td style="padding-right: 15px; padding-left: 18px; width: 150px;"><a href="{{ item.link }}"> <img style="margin: 1px; width: 150px; height: 150px;" src="{% if item|lookup:'media:content'|lookup:'0'|lookup:'@url' %}{{ item|lookup:'media:content'|lookup:'0'|lookup:'@url' }}{% else %}{{ item|lookup:'media:content'|lookup:'@url' }}{% endif %}" /></a></td>
</tr>
</tbody>
</table>
{% endfor %}</div>

 

 

Reply