Adding Blog Articles to Thank You Page

SOLVE
Terry
Member

On a thank you page I've created I'd like to add recently added blog articles to that page similar to what I see here.. 

https://blog.hubspot.com/blog/tabid/6307/bid/6117/thank-you-come-again-best-practices-for-thank-you-...

 

I like the look of the Related Articles and that's what I want added but the current modules for Post Listing and Post Filter does not accomplish what I want. The articles should updatea as I add new articles. Is there a way to do this easily?

 

Thanks

Terry

0 Upvotes
1 Accepted solution

Accepted Solutions
Jsum
Solution
Key Advisor

@Terry,

 

I find the easiest way to pull this off is to use a recent post function

{% set rec_posts = blog_recent_posts('default', 5) %}
{% for rec_post in rec_posts %}
    <div class="post-title">{{ rec_post.name }}</div>
{% endfor %}

and build the layout of my choosing inside of the for loop. All of the blog variables you use in a blog can be used here, including if you create custom fields, but instead of "content." you would use what ever the single item name for the loop is, in this case "rec_post". see: {{ rec_post.name }}.


View solution in original post

0 Upvotes
6 Replies 6
ashleyidesign
Top Contributor

Hey Terry,

 

This requires some tweaks to the CSS and possible javascript to get the look you're going for there. The default post listing/filters show the posts full-width of the module in a stacked list, and you need to get them in smaller columns instead.

 

If you're familiar with CSS then shouldn't be an issue, otherwise you'll need a designer's help with that.

0 Upvotes
Terry
Member

Hi Ashleigh

Thanks for the response here. My designers are COS certified but this seems to be a bit more than they can handle. Do you know of any resources I can look into?

 

Terry

0 Upvotes
Jsum
Solution
Key Advisor

@Terry,

 

I find the easiest way to pull this off is to use a recent post function

{% set rec_posts = blog_recent_posts('default', 5) %}
{% for rec_post in rec_posts %}
    <div class="post-title">{{ rec_post.name }}</div>
{% endfor %}

and build the layout of my choosing inside of the for loop. All of the blog variables you use in a blog can be used here, including if you create custom fields, but instead of "content." you would use what ever the single item name for the loop is, in this case "rec_post". see: {{ rec_post.name }}.


View solution in original post

0 Upvotes
catarinac-app
Member

Hello,

 

Can you write a step by step on how to  put the code on the template to make the related articles work?

 

Thank you!

0 Upvotes
ashleyidesign
Top Contributor

Hey Terry,

 

Let me know if you still have issues with the solution Jsum posted. Feel free to shoot me an email ashley at ashleyidesign.com

0 Upvotes
Terry
Member

Hi 

Been discussing this with my programmers and with a bit more customizing this snippet did seem to work. We're continuing to 'toy' with it but thanks it was definitely a step in the right direction.

 

Terry