- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Print set of not default blog posts
SOLVEJul 9, 2019 11:24 AM
Hi guys,
I need to show a set of blog posts on a page, that is not a blog template. I have several blogs, so I need to show posts from the exact one. This code shows posts from 'default' blog. Where to find something like blog's id so I'll be able to use this code.
{% set posts = blog_recent_posts('default', 5) %} {% for post in posts %} <h3><a href="{{ post.absolute_url }}">{{ post.name }}</a></h3> <img src="{{ post.featured_image }}" alt="{{ post.name }}"> {% endfor %}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Jul 9, 2019 11:51 AM
Each blog had a unique ID, you can find each one on the blog ID page. it's the set of numbers after /blog/ in the URL. Put that number in place of Default and it will only pull posts from that blog.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Jul 9, 2019 5:43 PM
When you are on the blog listing in the backend you will see something like this in your url
https://app.hubspot.com/blog/XXXXXXX/blogs/THISISTHEBLOGID/manage/posts/all
so instead of default you would replace that with th e"THISISTHEBLOGID" digits
{% set posts = blog_recent_posts('THISISTHEBLOGID', 5) %}
Dennis
![]() | We are excited to announce that the Community will be launching a weekly newsletter on November 2, 2020! Sign up today! |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content