Want to know the procedure for showing dynamic content ( blog posts ) in static HTML template


#1

Hi there,

We currently have footer hubspot template.

We have a Blog, we want to show blog posts in hubspot footer. How can we show the dynamic content in footer middle section?

Can you please advice?

Many thanks,
-Sabita.


#2

You can use RSS in custom HTML module


#3

Can you please give one example, how can show?

Many thanks,
-Sabita.


#4
<div class="recent-posts-item">
    {% set rec_posts = blog_recent_posts(your_blog_portal_id, No. Of posts to show) %}
    {% for rec_post in rec_posts %}
     <a href="{{rec_post.absolute_url}}" class="custom-post-item">
         
            
               
                <div class="custom-post-item-inner" >
                    <div class="features-image-block" style="background-image:url( {{ rec_post.post_list_summary_featured_image }});">
                        
                    </div>
                    <div class="custom-post-body clearfix">
                        <!--post summary-->
                        <h2>{{ rec_post.name }}</h2>
                        <span class="author-hubspot" data-hubspot-form-id="author_data" data-hubspot-name="Blog Author">
                            {{ rec_post.publish_date_local_time|datetimeformat('dd MMM YYYY') }} 
                        </span>
                                              
                    </div>
                </div>  
                
            
            
       </a>
    {% endfor %}

#5

Hi Laxmi_Narayan,

Thanks for the reply. I think my question is unclear :expressionless:

We have one hubspot id and there we have blogs. For one blog footer I want to show recent posts in that blog. And we have html template for the footer (attached image)

.

So there how can we show dynamic content.

Thanks,
-Sabita.


#6

basically you need only one post, right?

If you open blog in dashboard it will show you the blog id in url blogs/*******/manage/
That you need to update in code and you can use 1 in
{% set rec_posts = blog_recent_posts(*****, 1) %}
and it will show only one post which one is recent once, please let me know if you still have an issue


#7

Thanks a lot. Its working :slight_smile:

I used following for the author_name and published date.

by {{rec_post.blog_author}} on {{rec_post.publish_date}}

Can you please suggest, how can I format date in ‘on 24 November, 2017’ format?

Thanks
-Sabita.


#8

{{ rec_post.publish_date_local_time|datetimeformat(‘dd MMM , YYYY’) }}

Thanks,
Laxmi narayan