Sitemap Generator Tool

  • بادئ الموضوع بادئ الموضوع Unknown
  • تاريخ البدء تاريخ البدء
U

Unknown

Sitemap Generator Tool​

Base URL (e.g., https://yourblog.blogspot.com): Blog Post URLs (one per line): Generate Sitemap



Sitemap Code Description​


To generate a sitemap for a Blogger blog, you can manually create an XML sitemap using Blogger's features and some basic scripting.

Blogger does not support server-side scripting, so we'll use a combination of Blogger's capabilities and JavaScript to create a sitemap.



Steps to Create a Sitemap for Blogger​




Create a Static Sitemap Page​


Blogger does not support automatic sitemap generation, but you can create a static XML sitemap and link it to your blog.



Manually Add Links​


You'll need to add the URLs of your blog posts manually. Blogger's default sitemap URL is https://yourblog.blogspot.com/sitemap.xml.



Example Sitemap Generator Code​




Here’s a simple script to create a static XML sitemap that you can use for your Blogger blog:



HTML:
<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Sitemap Generator for Blogger</title>

    <style>

        body { font-family: Arial, sans-serif; padding: 20px; }

        label { display: block; margin: 10px 0 5px; }

        input, textarea { width: 100%; padding: 8px; margin-bottom: 10px; }

        button { padding: 10px 20px; background-color: #007BFF; color: white; border: none; cursor: pointer; }

        button:hover { background-color: #0056b3; }

        .result { margin-top: 20px; }

        .result pre { white-space: pre-wrap; word-wrap: break-word; }

    </style>

</head>

<body>

    <h1>Sitemap Generator for Blogger</h1>

    <form id="sitemapForm">

        <label for="baseURL">Base URL (e.g., https://yourblog.blogspot.com):</label>

        <input type="text" id="baseURL" required>



        <label for="urls">Blog Post URLs (one per line):</label>

        <textarea id="urls" rows="10" required></textarea>



        <button type="button" onclick="generateSitemap()">Generate Sitemap</button>

    </form>



    <div class="result" id="result"></div>



    <script>

        function generateSitemap() {

            const baseURL = document.getElementById('baseURL').value.trim();

            const urls = document.getElementById('urls').value.trim().split('\n').map(url => url.trim()).filter(url => url.length > 0);



            if (!baseURL || !urls.length) {

                alert("Please provide a valid base URL and at least one URL.");

                return;

            }



            let sitemapXML = `<?xml version="1.0" encoding="UTF-8"?>\n`;

            sitemapXML += `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n`;



            urls.forEach(url => {

                sitemapXML += `  <url>\n`;

                sitemapXML += `    <loc>${baseURL}/${url}</loc>\n`;

                sitemapXML += `    <lastmod>${new Date().toISOString().split('T')[0]}</lastmod>\n`;

                sitemapXML += `    <changefreq>monthly</changefreq>\n`;

                sitemapXML += `    <priority>0.5</priority>\n`;

                sitemapXML += `  </url>\n`;

            });



            sitemapXML += `</urlset>`;



            document.getElementById('result').innerHTML = `<h2>Generated Sitemap</h2><pre>${sitemapXML}</pre>`;

        }

    </script>

</body>

</html>



Instructions:​




1. Copy and Paste: Copy the code above into a new HTML file or an online HTML editor.

2. Open in Browser: Open the file in a web browser.

3. Fill in Details:

- Enter your blog’s base URL (e.g., https://yourblog.blogspot.com).

- Enter the relative URLs of your blog posts, each on a new line.

4. Generate Sitemap: Click the "Generate Sitemap" button to produce your XML sitemap.



Adding the Sitemap to Blogger​




1. Create a New Post: Go to Blogger and create a new post or page.

2. Paste the Sitemap: Copy the generated XML from the tool and paste it into the new post/page.

3. Publish: Publish the post/page as a static page (e.g., https://yourblog.blogspot.com/p/sitemap.html).



4. Submit to Search Engines: Use Google Search Console or other search engine tools to submit your sitemap URL.



Note: Blogger automatically generates a basic sitemap at https://yourblog.blogspot.com/sitemap.xml, but this method allows you to create a more customized sitemap if needed.

متابعة القراءة...
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

أحدث المواضيع