Last 3 blog posts on my site

Hello friends, I’m currently working on a project for my company, I have the section already made for this purpose, but as we will be having a blog I need my last 3 blog posts to be shown on this already built section of the page, I have been researching and I found about tables but this would not be the solution needed since we need the last blog posts to be shown as we post them on the blog on a dynamic way, containing featured image, title and link to post, I haven’t found a good solution for this, any ideas on this subject? Thank you so much in advance!

Hi @HorusChild,

you can build a custom module with the blog_recent_post function. It will do exactly what you want to achieve.

A very basic module can look like this

{% set rec_posts = blog_recent_posts("default", 3) %}
<div class="blogPostsWrapper">
{% for rec_post in rec_posts %}
<div class="singlePostWrapper">
<h4>{{ rec_post.name }}</h4>
<p class="postExcrept">{{ rec_post.post_body|striptags|truncate(150, '...', false) }}</p>
<a href="{{ rec_post.absolute_url }}" class="yourBtnClasses">read more</a>
</div>
{% endfor %}
</div>

best,

Anton