Blogger Trick – Using JSON APIs With Blogger to Include a Recent Posts Widget With Your Template

My wife changed into designing a blogger template, and she desired to consist of a segment for recent posts. There are plenty of Google widget code sections available for download on the Internet that permit a Blogger consumer to add a Recent Posts phase to a weblog. However, the subject matter for the Blogger template required the feature to be protected as an indispensable part of the template in preference to being elective. I’ll display to you the ways we executed the project. Vinzite

SimpleTrick-1.gif (1200×675)

Blogger mechanically generates an XML news feed for your blog. The feed lets human beings subscribe to your blog, so they may receive notices when submitting new posts. This routinely generated news feed is positioned at myblogname.Blogspot.Com/feeds/posts/default. For your unique weblog, substitute your real Blogger sub-domain in the region of my blog name. If you input your BlogSpot URL followed through /feeds/posts/default into a browser, you may see the feed in your weblog for your browser window.

Accessing the feed
Accessing your blog’s feed is achieved using a technology called JSON (JavaScript Object Notation) through a callback. I’ll explain what I suggest by that. You want to do two matters: 1) create a JavaScript function to technique the feed statistics; 2)Access the feed records and initiate the callback manner using a few question parameters. Here are the technical details.

Inside the blogger template, I positioned a piece of JavaScript code (which I borrowed from one of the wide to be had widgets I noted earlier) within the section of my spouse’s template the usage of the Blogger template editor that is accessed from a Blogger account with the aid of going to Layout -> Edit HTML. The script basically accesses the feed via the JSON parameter, parses out the weblog titles for the closing mum posts (this variable is exact within the callback mechanism explained later) weblog entries, and writes them out to the net file (as links to actual weblog posts) at the factor from which the feature is referred to as. Here’s the function:

READ MORE :

This block of code first sets a few JavaScript variables so that they are to be had while our show recent posts feature is later known as. You’ll note that mom posts are amongst those variables indexed. Mum posts determine what number of latest posts can be displayed.

The script block following the variables tells Blogger to access the information feed for the current weblog (/feeds/posts/default), order the feed entries through the date they were posted (order by-posted), install a JSON callback (alt=json-in-script), and call our characteristic to procedure the feeds (callback=showrecentposts). The critical query parameters to be aware of within the usage of a JSON callback are 1) alt=json-in-script, which tells Blogger we need to access the feed with a JavaScript feature; and 2) callback=showrecentposts, which tells Blogger to name our show recent posts characteristic. It’s important to notice that the name we use inside the query parameter should suit our feature’s call.

Indeed choosing a great blogging platform can be pretty taxing for internet website online owners. With the form of alternatives around, making the right preference isn’t always that clean to do. Each has its execs and cons, such that choosing one which works properly for your website is the maximum practical element to do.

The most famous picks for running a blog these days are WordPress and Blogger. Some webmasters decide upon WordPress, and some people decide on Blogger. So, which one is the ideal preference then?

There is practically a struggle taking place within the blogosphere. An average newbie is confronted with too many alternatives to pick from. To select the most suitable platform, though, it is crucial to take a look at every platform side with the aid of a facet and see which one you absolutely desire. Setting up a comparison scale lets you out determine the maximum appropriate blogging platform.

Between WordPress and Blogger, you have to decide which one gives ease of set-up and use customization and advanced use, and copyrights and possession content material.

Setting up a Blogger account can genuinely be achieved in 10 minutes. As quickly as you’re completed with the set-up, you can right now begin posting. Moreover, if you want a dressmaker’s contact on your weblog, tons of blogger templates are available free of charge. On the other hand, installing WordPress may be a headache if you don’t clearly know what you are doing. You want to download the setup files, add them to your server, set up a database, and run the configuration script yourself since you want to host WordPress to your personal account. However, in case you use cPanel, you can, without a doubt, do the setup with simply one-click on the mouse.

Publishing with Blogger can be a little inconvenient. Blogger doesn’t allow categories such which you can not type your articles into one-of-a-kind focuses. Posting articles with Blogger can take maximum, specifically if there are a few changes you will make on the net website. With WordPress, though, you may without difficulty add categories and show each category in a different way for your fundamental web page. With WordPress, publishing is tons quicker and extra convenient.

Finally, concerning copyrights and possession of content material, Blogger can be quite frustrating. With Blogger, Google definitely owns your content. This approach that Google has the authority to shut down your account if they do not like what you’re blogging about. Unfortunately, they do that without warning in any respect. In other words, you don’t have absolute control over your very own blog. On the alternative hand, with WordPress, you personal your very own area name. Since the blog is hosted for your account, you have got full control over your website. As such, you’re loose to write down about whatever and use the software program in any manner you want.

Share

Troublemaker. Wannabe music fanatic. Beer aficionado. Devoted food junkie. Twitter fan. Freelance thinker.Won several awards for analyzing sheep in Cuba. Spent 2002-2009 promoting action figures in the UK. What gets me going now is getting to know pond scum in the UK. Won several awards for investing in toy soldiers on the black market. Spent several months getting my feet wet with spit-takes in Gainesville, FL. Spent 2002-2009 testing the market for tobacco in the aftermarket.