CMS Development

egleeson
Contributor | Elite Partner
Contributor | Elite Partner

Creating a workflow email pulling blog posts by tag

SOLVE

Hello! I'm at my wits end trying to create an email for a workflow pulling the newest blog posts with a specific tag. I can pull recent posts, but whenever I re-code it to pull by tag, it breaks all the formatting.

 

Can't do an RSS email for the RSS feed because it can't be saved for automation and used in workflows.

 

Here's my code. The tag is "technical resources". Any help/guidance is MUCH appreciated!

{% set rec_posts = blog_recent_posts('4580349396', 2, tags="technical resources") %}
{% for rec_post in rec_posts %}
<div class="post-box">
<img style="width:100% !important; max-width:100% !important; height:auto !important " src="{{ rec_post.featured_image }}" alt="post-image">
<br>
<br>
<div class="post-content" style="padding-top:15px !important; padding-bottom:25px !important; padding:15px 20px 25px !important; font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif">
<h2 style="font-family:Arial, Helvetica, sans-serif !important; width:100% !important; font-weight:700 !important; color:#555555 !important; line-height:24px !important; font-size:22px !important; margin:0 !important; padding:5px 0 15px !important;" class="post-title">{{ rec_post.name }}</h2>
<div class="post-cbyline" style="font-family: Arial, Helvetica, sans-serif; color:#555555 !important">
by <a class="author-link" style="text-decoration:none; color:#555555;" href="{{ group.absolute_url }}/author/{{ rec_post.blog_post_author.slug }}">{{ rec_post.blog_post_author.display_name }}</a>, {{ rec_post.publish_date|datetimeformat('%m/%e/%Y') }}
</div>
<p> {{ rec_post.post_list_content }} </p>
<div class="post-link" style="text-align:center">
<a class="more-link" style=" font-family: Arial, Helvetica, sans-serif !important; background:#0066ff !important; min-width:148px !important; height:40px !important; border-radius:5px !important; line-height:40px !important; text-align:center !important; color:#fff !important; text-transform:uppercase !important; font-weight:700 !important; margin-top:20px !important; display:inline-block !important; text-decoration:none !important; float:none !important; margin-bottom:0 !important; " href="{{rec_post.absolute_url }}"><span style="color:#fff !important;" >Read More</span></a>
</div>

</div>
</div>
{% endfor %}

 

Thank you! 

0 Upvotes
1 Accepted solution
egleeson
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Creating a workflow email pulling blog posts by tag

SOLVE

Thanks for the help! I got a solution to this:

 

{% set rec_posts = blog_recent_topic_posts('4580349396', 'technical-resources', 2) %}

View solution in original post

0 Upvotes
3 Replies 3
roisinkirby
HubSpot Product Team
HubSpot Product Team

Creating a workflow email pulling blog posts by tag

SOLVE

Hey @egleeson could you please send a link to the live preview of the email and the blog you are using? @Jsum do you have any expertise in this area and/or can you recommend anyone in the Community who can help?

0 Upvotes
egleeson
Contributor | Elite Partner
Contributor | Elite Partner

Creating a workflow email pulling blog posts by tag

SOLVE
0 Upvotes
egleeson
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Creating a workflow email pulling blog posts by tag

SOLVE

Thanks for the help! I got a solution to this:

 

{% set rec_posts = blog_recent_topic_posts('4580349396', 'technical-resources', 2) %}
0 Upvotes