Hello,
I am having issues with the blog feed showing the created or current date, instead of the published date (when using the blog post settings to back date a post). Can you please advise?
I tried the code below:
<div class=“post-date”>{{ content.publish_date|datetimeformat(‘%B %e, %Y’) }}</div>
but it shows the actual created date, rather than the date I want to show (edited and back dated via the settings)
thanks
@JLeach18 Try using content.updated instead of content.publish_date.
Thanks, but this doesn’t work, it only shows the updated date from last week, in any case, all posts show the same date, instead of each showing a different date each that I want them to show (which you can edit in the individual post setting)
@JLeach18 As far as I’m aware publish_date should pull in whatever date is set in the blog’s settings so your predicament is rather strange. Could you post your code? Is this being written on a blog_post or blog_listing template?
Thanks for looking into it, it is a module to show the latest blog posts on the home page. Here is the code, I think what I need it to show is the timestamp rather than the published or created date (in red is what I have been updating and the date changes but never to the one I have as the publishing date option)
<span class=“date-posted”>
<span class=“date-icon”>
{% icon
name=“{{ module.blog_item_style.icons.date_icon.name }}”
style=“{{ module.blog_item_style.icons.date_icon.type }}”
unicode=“{{ module.blog_item_style.icons.date_icon.unicode }}”
%}
</span>
{{
post.created
|datetimeformat(“%B %e, %Y”) }}</span>
see screenshot to see which date I need showing:
@JLeach18 I need to see the entire code of the module to check that you’re pulling the correct information. Cause since you mentioned all the posts are showing the same date I’m wondering if your code is actually grabbing the home page’s date instead of the blog posts’.
Thanks, I eneded up removing the date altogether, unitl more blogposts will be published and so the dates will be relevant.
I know this is older but I wanted to provide alternative solution I found. We ran into a problem where blog posts that were set to draft and published later displayed the original draft date whether we used .created or .publish_date. We could use .update_date, but that isn’t really the intended functionality.
What you can do is use the schedule publish option on the post and that will give you the correct date based on whatever you set. If you schedule the post to publish on some day in the past, it will auto-update and your date will display correctly.