How to Add a Sitemap to Blogger for Better SEO

How to Add a Sitemap to Blogger for Better SEO


If you're a blogger looking to enhance your website's visibility on search engines and improve your SEO (Search Engine Optimization), adding a sitemap to your Blogger site is a crucial step. A sitemap helps search engines understand and crawl your site more efficiently, leading to better indexing and increased organic traffic. In this article, we will guide you through the process of adding a sitemap to your Blogger blog, ensuring that your content gets the recognition it deserves.

There are basically three methods to do this. Ensure to explore any of the three to decide which one suits your need;

First method:

Step 1: Generating Your Sitemap

Before you can add a sitemap to your Blogger blog, you need to generate the sitemap file. Fortunately, there are numerous online tools available that can generate a sitemap for you. You can use popular tools like XML-Sitemaps or Screaming Frog SEO Spider to create your sitemap. These tools will scan your website and create a structured XML file that contains a list of all your blog posts, pages, and other important URLs.


Step 2: Hosting Your Sitemap

Once you have generated your sitemap, you need to host it on the internet so that search engines can access it. There are several ways to host your sitemap, but one of the easiest methods is to use Google Drive. Follow these steps to host your sitemap on Google Drive:

1. Log in to your Google Drive account or create a new one if you don't have it.

2. Upload your sitemap XML file to Google Drive.

3. Right-click on the uploaded file and select "Share."

4. In the sharing options, set the visibility to "Public" or "Anyone with the link."

5. Copy the link generated for your sitemap file.


Step 3: Adding the Sitemap to Blogger

Now that you have your sitemap hosted on Google Drive, it's time to add it to your Blogger blog. Follow these steps to include the sitemap in your Blogger settings:

1. Go to blogger.com and log in to your Blogger account.

2. From the Blogger Dashboard, select the blog you want to add the sitemap to (if you have multiple blogs).

3. In the left-hand menu, click on "Settings."

4. Under the "Settings" tab, select "Search preferences."

5. In the "Crawlers and indexing" section, find the "Custom robots.txt" option and click "Edit."

6. In the custom robots.txt editor, add the following line:


   Sitemap: [Your sitemap URL]


   Replace [Your sitemap URL] with the link to your sitemap XML file hosted on Google Drive.

7. Click "Save changes" to update your settings.


Congratulations! You have successfully added a sitemap to your Blogger blog. It may take some time for search engines to recognize and process the sitemap, so be patient.


Second Method:

To begin, follow the steps below:


Step 1: Accessing the Template Editor

1. Go to your Blogger dashboard and select the blog you want to add the sitemap to.

2. From the left-hand menu, click on "Theme."

3. On the Theme page, click the "Edit HTML" button to access the template editor.


Step 2: Adding the Sitemap Code

1. Before making any changes, it's always a good idea to backup your template. Click on the "Download Full Template" button to save a copy of your current template.

2. Now, scroll through the code and find the closing `</head>` tag. You can do this by using the search function in your browser (usually accessible via `Ctrl+F` or `Cmd+F`).

3. Once you've located the closing `</head>` tag, copy the following sitemap code provided below:

<script type="text/javascript">

var postTitle = new Array();

var postUrl = new Array();

var postPublished = new Array();

var postDate = new Array();

var postLabels = new Array();

var postRecent = new Array();

var sortBy = "titleasc";

var numberfeed = 0;


function bloggersitemap(a) {

    function b() {

        if ("entry" in a.feed) {

            var d = a.feed.entry.length;

            numberfeed = d;

            ii = 0;

            for (var h = 0; h < d; h++) {

                var n = a.feed.entry[h];

                var e = n.title.$t;

                var m = n.published.$t.substring(0, 10);

                var j;

                for (var g = 0; g < n.link.length; g++) {

                    if (n.link[g].rel == "alternate") {

                        j = n.link[g].href;

                        break

                    }

                }

                var o = "";

                for (var g = 0; g < n.link.length; g++) {

                    if (n.link[g].rel == "enclosure") {

                        o = n.link[g].href;

                        break

                    }

                }

                var c = "";

                if ("category" in n) {

                    for (var g = 0; g < n.category.length; g++) {

                        c = n.category[g].term;

                        var f = c.lastIndexOf(";");

                        if (f != -1) {

                            c = c.substring(0, f)

                        }

                        postLabels[ii] = c;

                        postTitle[ii] = e;

                        postDate[ii] = m;

                        postUrl[ii] = j;

                        postPublished[ii] = o;

                        if (h < 10) {

                            postRecent[ii] = true

                        } else {

                            postRecent[ii] = false

                        }

                        ii = ii + 1

                    }

                }

            }

        }

    }

    b();

    sortBy = "titledesc";

    sortPosts(sortBy);

    sortlabel();

    displayToc();

}


function sortPosts(d) {

    function c(e, g) {

        var f = postTitle[e];

        postTitle[e] = postTitle[g];

        postTitle[g] = f;

        var f = postDate[e];

        postDate[e] = postDate[g];

        postDate[g] = f;

        var f = postUrl[e];

        postUrl[e] = postUrl[g];

        postUrl[g] = f;

        var f = postLabels[e];

        postLabels[e] = postLabels[g];

        postLabels[g] = f;

        var f = postPublished[e];

        postPublished[e] = postPublished[g];

        postPublished[g] = f;

        var f = postRecent[e];

        postRecent[e] = postRecent[g];

        postRecent[g] = f

    }

    for (var b = 0; b < postTitle.length - 1; b++) {

        for (var a = b + 1; a < postTitle.length; a++) {

            if (d == "titleasc") {

                if (postTitle[b] > postTitle[a]) {

                    c(b, a)

                }

            }

            if (d == "titledesc") {

                if (postTitle[b] < postTitle[a]) {

                    c(b, a)

                }

            }

            if (d == "dateoldest") {

                if (postDate[b] > postDate[a]) {

                    c(b, a)

                }

            }

            if (d == "datenewest") {

                if (postDate[b] < postDate[a]) {

                    c(b, a)

                }

            }

            if (d == "orderlabel") {

                if (postLabels[b] > postLabels[a]) {

                    c(b, a)

                }

            }

        }

    }

}


function sortlabel() {

    sortBy = "orderlabel";

    sortPosts(sortBy);

    var a = 0;

    var b = 0;

    while (b < postTitle.length) {

        temp1 = postLabels[b];

        firsti = a;

        do {

            a = a + 1

        } while (postLabels[a] == temp1);

        b = a;

        sortPosts2(firsti, a);

        if (b > postTitle.length) {

            break

        }

    }

}


function sortPosts2(d, c) {

    function e(f, h) {

        var g = postTitle[f];

        postTitle[f] = postTitle[h];

        postTitle[h] = g;

        var g = postDate[f];

        postDate[f] = postDate[h];

        postDate[h] = g;

        var g = postUrl[f];

        postUrl[f] = postUrl[h];

        postUrl[h] = g;

        var g = postLabels[f];

        postLabels[f] = postLabels[h];

        postLabels[h] = g;

        var g = postPublished[f];

        postPublished[f] = postPublished[h];

        postPublished[h] = g;

        var g = postRecent[f];

        postRecent[f] = postRecent[h];

        postRecent[h] = g

    }

    for (var b = d; b < c - 1; b++) {

        for (var a = b + 1; a < c; a++) {

            if (postTitle[b] > postTitle[a]) {

                e(b, a)

            }

        }

    }

}


function displayToc() {

    var a = 0;

    var b = 0;

    while (b < postTitle.length) {

        temp1 = postLabels[b];

        document.write("");

        document.write('<div class="post-archive"><h4>' + temp1 + '</h4><div class="ct-columns">');

        firsti = a;

        do {

            document.write("<p>");

            document.write('<a " href="' + postUrl[a] + '">' + postTitle[a] + "");

            if (postRecent[a] == true) {

                document.write(' - <strong><span>New!</span></strong>')

            }

            document.write("</a></p>");

            a = a + 1

        } while (postLabels[a] == temp1);

        b = a;

        document.write("</div></div>");

        sortPosts2(firsti, a);

        if (b > postTitle.length) {

            break

        }

    }

}

</script>

<script src="https://emjaysblog.com.ng/feeds/posts/summary?alt=json-in-script&amp;max-results=9999&amp;callback=bloggersitemap" type="text/javascript"></script>

 

4. Paste the copied code just above the closing `</head>` tag in the template editor.

5. Once you have pasted the code, click the "Save" button to save the changes made to your template.


Step 3: Customizing the Sitemap Code

1. In the sitemap code, you'll notice the URL 

`https://emjaysblog.com.ng/feeds/posts/summary?alt=json-in-script&amp;max-results=9999&amp;callback=bloggersitemap`. 

Replace this URL with your own blog's URL.

2. To customize the URL, locate the following line in the code:



<script src="https://emjaysblog.com.ng/feeds/posts/summary?alt=json-in-script&amp;max-results=9999&amp;callback=bloggersitemap" type="text/javascript"></script>



3. Replace `https://emjaysblog.com.ng` with your own blog's URL. Make sure to keep the `/feeds/posts/summary?alt=json-in-script&amp;max-results=9999&amp;callback=bloggersitemap` part intact.


Step 4: Preview and Save Changes

1. After customizing the URL, click the "Save" button in the template editor to save the changes.

2. Now, click the "Preview" button to see how the sitemap will appear on your blog.


Congratulations! You have successfully added a sitemap to your Blogger blog. This will help search engines crawl and index your blog's content more efficiently, improving its visibility in search results. Remember to periodically update your sitemap whenever you publish new posts to ensure that search engines are aware of your latest content. 


Third Method:

Step 1: Customize the URL

Before we begin, make sure to customize the URL in the code snippet provided below. Replace "emjaysblog.com.ng" with your own domain name.

Here is the sitemap code snippet:



<script type="text/javascript">

var postTitle = new Array();

var postUrl = new Array();

var postPublished = new Array();

var postDate = new Array();

var postLabels = new Array();

var postRecent = new Array();

var sortBy = "titleasc";

var numberfeed = 0;


function bloggersitemap(a) {

    function b() {

        if ("entry" in a.feed) {

            var d = a.feed.entry.length;

            numberfeed = d;

            ii = 0;

            for (var h = 0; h < d; h++) {

                var n = a.feed.entry[h];

                var e = n.title.$t;

                var m = n.published.$t.substring(0, 10);

                var j;

                for (var g = 0; g < n.link.length; g++) {

                    if (n.link[g].rel == "alternate") {

                        j = n.link[g].href;

                        break;

                    }

                }

                var o = "";

                for (var g = 0; g < n.link.length; g++) {

                    if (n.link[g].rel == "enclosure") {

                        o = n.link[g].href;

                        break;

                    }

                }

                var c = "";

                if ("category" in n) {

                    for (var g = 0; g < n.category.length; g++) {

                        c = n.category[g].term;

                        var f = c.lastIndexOf(";");

                        if (f != -1) {

                            c = c.substring(0, f);

                        }

                        postLabels[ii] = c;

                        postTitle[ii] = e;

                        postDate[ii] = m;

                        postUrl[ii] = j;

                        postPublished[ii] = o;

                        if (h < 10) {

                            postRecent[ii] = true;

                        } else {

                            postRecent[ii] = false;

                        }

                        ii = ii + 1;

                    }

                }

            }

        }

    }

    b();

    sortBy = "titledesc";

    sortPosts(sortBy);

    sortlabel();

    displayToc();

}

function sortPosts(d) {

    function c(e, g) {

        var f = postTitle[e];

        postTitle[e] = postTitle[g];

        postTitle[g] = f;

        var f = postDate[e];

        postDate[e] = postDate[g];

        postDate[g] = f;

        var f = postUrl[e];

        postUrl[e] = postUrl[g];

        postUrl[g] = f;

        var f = postLabels[e];

        postLabels[e] = postLabels[g];

        postLabels[g] = f;

        var f = postPublished[e];

        postPublished[e] = postPublished[g];

        postPublished[g] = f;

        var f = postRecent[e];

        postRecent[e] = postRecent[g];

        postRecent[g] = f;

    }

    for (var b = 0; b < postTitle.length - 1; b++) {

        for (var a = b + 1; a < post


Title.length; a++) {

            if (d == "titleasc") {

                if (postTitle[b] > postTitle[a]) {

                    c(b, a);

                }

            }

            if (d == "titledesc") {

                if (postTitle[b] < postTitle[a]) {

                    c(b, a);

                }

            }

            if (d == "dateoldest") {

                if (postDate[b] > postDate[a]) {

                    c(b, a);

                }

            }

            if (d == "datenewest") {

                if (postDate[b] < postDate[a]) {

                    c(b, a);

                }

            }

            if (d == "orderlabel") {

                if (postLabels[b] > postLabels[a]) {

                    c(b, a);

                }

            }

        }

    }

}

function sortlabel() {

    sortBy = "orderlabel";

    sortPosts(sortBy);

    var a = 0;

    var b = 0;

    while (b < postTitle.length) {

        temp1 = postLabels[b];

        firsti = a;

        do {

            a = a + 1;

        } while (postLabels[a] == temp1);

        b = a;

        sortPosts2(firsti, a);

        if (b > postTitle.length) {

            break;

        }

    }

}

function sortPosts2(d, c) {

    function e(f, h) {

        var g = postTitle[f];

        postTitle[f] = postTitle[h];

        postTitle[h] = g;

        var g = postDate[f];

        postDate[f] = postDate[h];

        postDate[h] = g;

        var g = postUrl[f];

        postUrl[f] = postUrl[h];

        postUrl[h] = g;

        var g = postLabels[f];

        postLabels[f] = postLabels[h];

        postLabels[h] = g;

        var g = postPublished[f];

        postPublished[f] = postPublished[h];

        postPublished[h] = g;

        var g = postRecent[f];

        postRecent[f] = postRecent[h];

        postRecent[h] = g;

    }

    for (var b = d; b < c - 1; b++) {

        for (var a = b + 1; a < c; a++) {

            if (postTitle[b] > postTitle[a]) {

                e(b, a);

            }

        }

    }

}

function displayToc() {

    var a = 0;

    var b = 0;

    while (b < postTitle.length) {

        temp1 = postLabels[b];

        document.write("");

        document.write('<div class="post-archive"><h4>' + temp1 + '</h4><div class="ct-columns">');

        firsti = a;

        do {

            document.write("<p>");

            document.write('<a " href="' + postUrl[a] + '">' + postTitle[a] + "");

            if (postRecent[a] == true) {

                document.write(' - <strong><span>New!</span></strong>');

            }

            document.write("</a></p>");

            a = a + 1;

        } while (postLabels[a] == temp1);

        b = a;

        document.write("</div></div>");

        sortPosts2(firsti, a);

        if (b > postTitle.length) {

            break;

        }

    }

}

</script>

<script src="https://emjaysblog.com.ng/feeds/posts/summary?alt=json-in-script&amp;max-results=9999&amp;callback=bloggersitemap" type="text/javascript"></script>



Step 2: Create a Sitemap Page

In your Blogger dashboard, navigate to the "Pages" section and click on "New Page" to create a new page. Give the page a title, such as "Sitemap."


Step 3: Switch to HTML View and Paste the Code

In the page editor, switch from the "Compose" view to the "HTML" view. Then, paste the code snippet just below the `<p>&nbsp;</p>` code. This is where your sitemap will be generated.


Step 4: Publish the Page

Once you've pasted the code, click on the "Publish" button to make the sitemap page live on your blog.


Step 5: Copy the Sitemap Page URL

After publishing the sitemap page, click on the share icon next to the page title to copy the URL link to the sitemap page. You will need this URL in the next step.


Step 6: Add Sitemap to Blog Layout

Now, go to the "Layout" section of your Blogger dashboard. Look for the menu footer and click on the "Configure" link list option.


Step 7: Add a New Item

Within the "Configure Link List" section, click on "Add a Gadget" and select the "Link List" gadget. Paste the copied URL of your sitemap page into the "New Site URL" field and enter "Sitemap" as the site name or placeholder.


Step 8: Save the Changes

Click on the "Save" button to save your changes. The sitemap link will now be added to your blog's footer menu.


Congratulations! You have successfully added a sitemap to your Blogger blog. This will help search engines discover and index your content more efficiently.

Post a Comment

0 Comments