Sunday, February 17, 2013

Make a Sitemap Page in Blogger

This is about how to make sitemap page in blogger to show all posts you've published. This sitemap will update automatically each time you create a new post.

To make it work it is not necessary to edit the Blogger template code, just follow these steps:

  1. Create a new page (not a new post).
  2. Click on the HTML tab.
  3. Copy the following code inside:
<script>
var numposts = 1000;
var showpostdate = true;
var showpostsummary = false;
var numchars = 200;
</script>
<script>
function rp(json) {
document.write('<ul>');
for (var i = 0; i < numposts; i++) {
document.write('<li>');
var entry = json.feed.entry[i];
var posttitle = entry.title.$t;
var posturl;
if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
break;
}
}
posttitle = posttitle.link(posturl);
var readmorelink = "(more)";
readmorelink = readmorelink.link(posturl);
var postdate = entry.published.$t;
var cdyear = postdate.substring(0,4);
var cdmonth = postdate.substring(5,7);
var cdday = postdate.substring(8,10);
var monthnames = new Array();
monthnames[1] = "Jan";
monthnames[2] = "Feb";
monthnames[3] = "Mar";
monthnames[4] = "Apr";
monthnames[5] = "May";
monthnames[6] = "Jun";
monthnames[7] = "Jul";
monthnames[8] = "Aug";
monthnames[9] = "Sep";
monthnames[10] = "Oct";
monthnames[11] = "Nov";
monthnames[12] = "Dec";
if ("content" in entry) {
var postcontent = entry.content.$t;
} else if ("summary" in entry) {
var postcontent = entry.summary.$t;
} else
var postcontent = "";
var re = /<S[^>]*>/g;
postcontent = postcontent.replace(re, "");
document.write(posttitle);
if (showpostdate == true) document.write(' ' + cdyear + ' - ' + monthnames[parseInt(cdmonth,10)] + ' ' + cdday);
if (showpostsummary == true) {
if (postcontent.length < numchars) {
document.write(postcontent);
} else {
postcontent = postcontent.substring(0, numchars);
var quoteEnd = postcontent.lastIndexOf(" ");
postcontent = postcontent.substring(0,quoteEnd);
document.write(postcontent + '...' + readmorelink);
}
}
document.write('</li>');
}
document.write('</ul>');
}
</script>  

<script src="http://www.yourwebsitenamehere.com/atom.xml?redirect=false&start-index=1&max-results=1000&orderby=published&alt=json-in-script&callback=rp"></script>




Don't forget to put your web site name where I've marked it in red.
When you publish it you will see the sitemap (you can check mine).
The trick to show all published post is in these two parameters:
  • var numposts = 1000;
  • max-results=1000
If you have got more than 1000 posts just change this number to your convenience.
If you don't want to show the date beside the post title then change the line:
var showpostdate = false;

The good thing about it is that you do no need to install a widget or modify the code in your template and for some the Blog archive widget is not convenient because you've got to click on every month to see all the post listed inside.
Now you have a list with all the posts from your website in one single page.

April 2013 Update:

New version with all blog posts separated by month and year

You may like this new version better, it organizes posts by blocks of month and year, then the day number is before the post title, just take a look at my sitemap for blogger , here is the code:

<script>
var numposts = 10000;
var showpostdate = true;
var showpostsummary = false;
var numchars = 200;
var lastDate ="";
</script>
<script>
function rp(json) {
document.write('<ul style=list-style-type:none;>');
for (var i = 0; i < numposts; i++) {
var entry = json.feed.entry[i];
var posttitle = entry.title.$t;
var posturl;
if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
break;
}
}
posttitle = posttitle.link(posturl);
var readmorelink = "(more)";
readmorelink = readmorelink.link(posturl);
var postdate = entry.published.$t;
var cdyear = postdate.substring(0,4);
var cdmonth = postdate.substring(5,7);
var cdday = postdate.substring(8,10);

var monthnames = new Array();
monthnames[1] = "Jan";
monthnames[2] = "Feb";
monthnames[3] = "Mar";
monthnames[4] = "Apr";
monthnames[5] = "May";
monthnames[6] = "Jun";
monthnames[7] = "Jul";
monthnames[8] = "Aug";
monthnames[9] = "Sep";
monthnames[10] = "Oct";
monthnames[11] = "Nov";
monthnames[12] = "Dec";
if ("content" in entry) {
var postcontent = entry.content.$t;
} else if ("summary" in entry) {
var postcontent = entry.summary.$t;
} else
var postcontent = "";
var re = /<S[^>]*>/g;
postcontent = postcontent.replace(re, "");


if (lastDate!=cdyear + monthnames[parseInt(cdmonth,10)])
{
    document.write('<li><h4>' + monthnames[parseInt(cdmonth,10)] + ' ' +cdyear +'</h4></li>');
    lastDate=cdyear + monthnames[parseInt(cdmonth,10)]
}
document.write('<li> ' + cdday +' ');
document.write(posttitle);

if (showpostsummary == true) {
if (postcontent.length < numchars) {
document.write(postcontent);
} else {
postcontent = postcontent.substring(0, numchars);
var quoteEnd = postcontent.lastIndexOf(" ");
postcontent = postcontent.substring(0,quoteEnd);
document.write(postcontent + '...' + readmorelink);
}
}
document.write('</li>');
}
document.write('</ul>');
}
</script> 

<script src="http://
www.yourwebsitenamehere.com/atom.xml?redirect=false&start-index=1&max-results=50000&orderby=published&alt=json-in-script&callback=rp"></script>

Thursday, February 14, 2013

The Motorola X Phone Better than the iPhone and Samsung

Up to now Samsung and Apple have been dominating the smartphone market with 50% market share between them and have for the moment no serious competitor.
Nokia, BlackBerry, HTC, ZTE, Huawei, and Sony, all these manufacturers are in the second division and Motorola and is actually part of it.
But according to the Australian site Smarthouse, Hugh Bradlow, Director of Technology at Telstra (first operator in the country), have told his team that the future of Motorola smartphone will change the market and "put pressure on Samsung and Apple."

The Motorola X Phone is the first true smartphone produced under the control of Google, and could be released this summer, maybe on the presentation in three months at the Google I / O that will be from the 15th to 17th May. All indications are that this will be the first smartphone to be accompanied by a future version of Android (5.0 or Key Lime Pie).
But the other devices will also benefit from the new Adroid version shortly after so Motorola will have to find other features to offer if he wants to rise up its sales.

X Phone new features

Motorola 4G

According to Motorola the X Phone is the object of attention for Google and "possess software, features and capabilities that are not available in the Samsung Galaxy smartphones and Apple iPhone. The software is really powerful and it brings Google services like no other manufacturer has done in the past."


In December, the Wall Street Journal, which was the first to light the fuse, already stated that it could benefit future smartphone technology Viewdle, a company acquired by Google last year and specializes in facial recognition. The newspaper added that this X Phone is the basis for the output of a touchpad, also decked out with an X, in order to really compete with Samsung and Apple Google could implement a huge marketing plan.

Other rumors have suggested that the unit is armed with a 5-inch screen with almost no border around the smartphone, as well as 128 GB of storage and the best sensor ever offered from the manufacturer. Characteristics that have nothing revolutionary, but allow Motorola to offer a truly competitive device.

Wow! I'm waiting to see this! What else they will do? Holographic 3D projection over locations?
3D Games?