October 14, 2020

Blogger: Add Last Updated / Modified Date

I was looking for a way how to display the Last modified date besides the first published date in my Blogger blog.

I have found the solution here: https://www.twistblogg.com/blog/last-updated-date-in-blogger 

You shall add in your HTML Blog Template following code:


Below the block  <span class='post-timestamp'>...data:post.timestampISO8601</span>

Updated on:    
<span class='updated' expr:title='"Post was updated on " + data:post.lastUpdatedISO8601' id='updatedateinfo' itemprop='dateModified'>  
    <data:post.lastUpdatedISO8601/>  
  </span>  
  <script>  
    var dates = "<data:post.lastUpdatedISO8601/>";  
    var dateu = new Date(dates);  
    var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];  
    document.getElementById("updatedateinfo").innerHTML = months[dateu.getMonth()] + " " + dateu.getDate() + ", " + dateu.getFullYear();  
  </script>

This will then appear in the footer. 


You shall remove the footer from the Home page because it isn't displayed properly in this view.

No comments:

Post a Comment