Blog, Website & Page Publishing

AFisher725
Member

Adding Date to Blog Listing

SOLVE

Hi - 

I have the date on my blog post, but how do I get the date to show up under the title in a blog listing page?

Please advise asap.

Thank you!

0 Upvotes
1 Accepted solution
MatthewShepherd
Solution
Key Advisor

Adding Date to Blog Listing

SOLVE

Hi @AFisher725 


This post will tell you how to edit your blog template. You need to edit your listing template. If that doesn't help you find your listing template then navigate to settings (cog in top right) -> website (in left sidebar) -> blog ->templates (tab) and then look for 'Template for listing pages' and click the edit button beside this.

 

hs-blog-listing-edit.jpg

 



Once you are into your listing  template in design manager look for the title of your post, it should look something like this, and note depending on your blog template this could appear multiple times in the template so add your date code beneath each instance:

 

<h2><a href="{{content.absolute_url}}">{{ content.name }}</a></h2>

 

Beneath this add code like one of the following, depending on what date format you want:

 

Full localised timestamp of post publish date and time

<div class="blog-post__timestamp">
 {{ content.publish_date_localized }}
</div>

 

Custom date without time (you can move around day month year variables to reflect the format you need)

<div class="custom-date">
 {{ content.publish_date_local_time.strftime('%d') }}
 {{ content.publish_date_local_time.strftime('%B') }},
 {{ content.publish_date_local_time.strftime('%Y') }}
</div>


Hope that helps!

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.

View solution in original post

4 Replies 4
esraszrr
Member

Adding Date to Blog Listing

SOLVE

for only date:

 

<div class="content-date">
{{ blogpost.publishDate|datetimeformat('%B %e, %Y') }}
</div>

0 Upvotes
AFisher725
Member

Adding Date to Blog Listing

SOLVE

Yes! After playing around to find the right location, it did work! Thank you so much.

MatthewShepherd
Solution
Key Advisor

Adding Date to Blog Listing

SOLVE

Hi @AFisher725 


This post will tell you how to edit your blog template. You need to edit your listing template. If that doesn't help you find your listing template then navigate to settings (cog in top right) -> website (in left sidebar) -> blog ->templates (tab) and then look for 'Template for listing pages' and click the edit button beside this.

 

hs-blog-listing-edit.jpg

 



Once you are into your listing  template in design manager look for the title of your post, it should look something like this, and note depending on your blog template this could appear multiple times in the template so add your date code beneath each instance:

 

<h2><a href="{{content.absolute_url}}">{{ content.name }}</a></h2>

 

Beneath this add code like one of the following, depending on what date format you want:

 

Full localised timestamp of post publish date and time

<div class="blog-post__timestamp">
 {{ content.publish_date_localized }}
</div>

 

Custom date without time (you can move around day month year variables to reflect the format you need)

<div class="custom-date">
 {{ content.publish_date_local_time.strftime('%d') }}
 {{ content.publish_date_local_time.strftime('%B') }},
 {{ content.publish_date_local_time.strftime('%Y') }}
</div>


Hope that helps!

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.
TiphaineCuisset
Community Manager
Community Manager

Adding Date to Blog Listing

SOLVE

Hi @AFisher725 

 

Thank you for reaching out

 

I want to tag some of our experts on this - @Alex_ @Gonzalo @MatthewShepherd do you have any thoughts to share with @AFisher725 on this? 

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 Upvotes