You may have seen notifications a long time ago on different
types of social media sites. If you want to implement this format for a long
time on blogger blogs, this article is for you. In this article, we will see how we can add the long back notification
format on our blogger blog in simple and easy steps.
I recently received a comment from one of the visitors who
wants to add time ago notification a
long-back notification format to his blogger site.
To add this way back time ago notification format to Blogger blog, you need to have some
knowledge of Blogger XML tags and a
little information about web design, especially HTML and JavaScript languages.
You need to have some information about web design because here
we have to find some things that we have to find and replace with some new
things.
These are not the things, they are lines of code.
Okay, now let's look at the steps to add this format from
long ago on our blogger blog. You
can also add the post time format of this post on the WordPress website if you want the technique to be no different.
First of all, if you want to see the demo of this format
from a while ago, scroll up and see when this post was published. You will see
that the post publishing time will become how long this post was published,
that is, you will see it 1 day ago, 2 days ago, 3 months ago, 5 months ago and
so on.
Here we will use our jQuery
plugin to add this format from long ago. I have transformed the code in
such a way that this plugin will not
affect the time and size of your web page.
This plugin reads the timestamps that are provided as input
in date, month and year format or any other date format and converts them to
time back format.
Now just follow these steps to add this long-time
notification format on Blogger or WordPress site.
1. Go to Blogger dashboardSteps to add posted the time-ago in blogger blog:
2. Go to Theme / Template section
3. Now search for <data: post.date/> or <data: post.date header />
To search for anything in the Blogger templates section, press Ctrl + F and then type your search term and hit enter.
4. Now replace the code we found in step 4 with the code given below.
<b:tag name='span' class='timeago'>
<data:post.date/> </b:tag>
5. find </body> and paste the code provided below, just above the </body> tag.
<script>//<![CDATA[ jQuery.cachedScript=function(e,c){return c=$.extend(c||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(c)}; $.when($.cachedScript("https://timeago.yarp.com/jquery.timeago.js"), $.Deferred(function (e) { $(e.resolve) })).done(function () { $("span.timeago").timeago(); }).fail(function (e, o, c) { alert("Error Occured Whils loading Files") })//]]></script>
to run the above code, you need to add the jQuery library or plugin if your blog doesn't already have it. To add it, just copy the code provided below and add it just above the </head> tag.
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'></script>
6. Save the total process.
So please read the steps provided above carefully and do what is said. The steps provided above are for the blogger blog, but the codes will be the same if you want to add this format on the WordPress website.
Conclusion:
That's all about adding the formatting from long how to add time ago on the Blogger blog. If you have any difficulty finding some code or something else please let me know in the comment section and I will help you asap.
Post a Comment