Email Newsletter


#1

We want to setup an email for weekly subscription, but we don’t seem to have a way of sorting the blog posts to be included into the email only if they were published in the last week? Are we missing something? Is there a way to include the post only if that criteria is met? We are using the default recent_posts HubL function.

Thanks in advance.


#2

@Sergey_Grigoryan you can create that in the content settings at the bottom.
Ex.


#3

Thanks for the reply.

We did that, however, my question was a bit different. We want to customize the default email, so we have used a custom email template we have developed, and it sends the recent 10 blog posts. However, we want it to send ONLY the posts which were published in the last week at the moment of sending the email, and NOT anything else. So we don’t want to send the same blog post in 2 consequent newsletters. Is that possible? I think there should be a HubL function, module, or property for this, but I didn’t find anything in the Reference.


#4

@Sergey_Grigoryan If you dive into the email it self you can bring up the source code of the body.

<h2 style="padding-bottom: 0; margin: 0 0 5px 0;"><span style="font-size: 18px; color: #3366ff;"><a href="{{post.url}}" style="color: #3366ff;">{{post.title}}</a></span></h2>
<p style="padding-top: 0; margin-top: 0;"><span style="color: {{secondary_font_color}};">{{post.author_line}}{{post.publish_date}}</span></p>
{{post.featured_image}}
<div>{{post.summary}}</div>
<p><span style="color: #3366ff;"><a href="{{post.url}}" style="color: #3366ff;">Read more »</a></span></p>
</div>```

You can see it gives you the publish data.  You should be able to write some logic in HubL to display it if and only if the publish date is within a week.  Please let me know if this works out or not. I have not come across someone wanting to cut down on the blog posts by timeline just yet.  Great use case though!

#5

@Sergey_Grigoryan the functionality to ensure that only the correct posts will be sent is already built into the implementation of the Blog email system which is shown in Content settings. It ensures that it will not send the same post twice. Choose “Weekly Notification” in blog settings - then customise the template of that email. You can choose the maximum number of posts inside the email editor, and shouldn’t need custom HubL to do this.