But! I don’t like doing that with the only way I have found as described below. (I guess you were expecting that word to be written first.)
Last updated/modified date of blog post isn’t available for normal bloggers on Blogger or template developers to perfect their amazing templates. If you follow the no modification rule for blogging, then you won’t need it since you won’t press Publish button for second time for a post. If you are a blogger like me, you want to fix your posts, even a typo, you may want this kind of date to be shown to your readers, especially you make a major change to your post and you do not want to add a section for recording changes you have made to the post.
Let’s stop the wordy description for a second and see the action part, shall we?
Here is a popular post of mine and I have made few changes a few times,
The basic code using jQuery is:
var blogID = '3803541356848955053'; var postID = '1127403767086065'; $.getJSON('http://www.blogger.com/feeds/' + blogID + '/' + 'posts/summary/' + postID + '?alt=json-in-script&callback=?', function(data) { // doing blah blah blah here });
It utilizes Blogger API to retrieve post’s summary data in JSON format. It’s easy to parse the date string and to re-format it to be a more human-readable format any style you want. With this method of showing dates, it requires two parameters, blog ID and post ID. They are easy to find in DOM. If it’s a standard Blogger template, they are in one of <meta/> if it’s a single post page. For home or archive pages, etc., you can find them in if Email Post feature is enabled. Or you can modify template to include a numeric post ID using Layouts Data Tags.
Is this the only way? I am afraid so. I can’t find any reference for last updated in data tags, or any useful posts on help forums. I didn’t ask on forums, because I don’t expect a Blogger staff will reply to tell me if there is a such data tag or there is not. I also tried to make up few data tags to see if I could find a secret tag for modified dates, but I found none.
Give me an hour, I could have a working script to be used on my blog, but I won’t do it. Because multiple posts require multiple Blogger API requests, and I doubt many people will be really interested in knowing when I update my posts. If Blogger API can allow selecting multi-posts using post IDs as if how Disqus shows the number of comments for each posts, I might write the script.
I also believe in showing to users how long have a post been published and last updated is important, because a post about computer or technology, it could be outdated very quickly. Letting readers be aware of the post age might be helpful, because they might leave a comment saying “You stuff isn’t working…,” which most likely implying your stuff is a crap. I had wanted to implement a reporting system using Google Analytics’ event feature, or using Google App Engine, but I never did.
Anyway, if you are so wanting to have Last Updated on your blog and your blog’s template is close to standard/official Blogger template, leave a comment (DO NOT leave your blog link in comment body). If many people also join you, I will leave a comment so you will receive an update email, which to let people know I am going to write a script for your guys and you can email me your blog link.
Displaying the Last Modified Date within a Web Page
ReplyDeleteAn example of how this works.
Hi, this article is the closest to what I googled for.. Basically I want to add a meta tag of 'last-modified' to my individual blogger page.. something similar to
ReplyDeleteHowever this code was rendered as..
Obviously there is no variable 'data:blog.pageTimestamp', nor other similar variables like 'data:blog.timestamp', 'data:blog.post.timestamp' etc..
Could you teach me how to make this work?
~bowo~
I wish I could. Your approach is correct, but the problem we all are facing is there is no data tag for such timestamp.
ReplyDeleteIn other words, no one can make this work, ie. using meta or simply output a timestamp.
The only way is to ask Blogger to add such data tag. Go to Blogger, search for that, there is already a few posts about this issue. Tell Blogger why you need that and pray.
An advice: just don't give your hope up, so you won't get disappointed again.
so that's why I couldn't find the solution even after googled all over the web for days.. thank you very much..
ReplyDelete