diposkan pada : 19-06-2024 06:13:33

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

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

<title>Sitemap Generator</title>

<style>

     body {

         font-family: Arial, sans-serif;

         background-color: #f0f0f0;

         display: flex;

         justify-content: center;

         align-items: center;

         height: 100vh;

         margin: 0;

         flex-direction: column;

     }

 

     .container {

         width: 400px;

         background-color: #fff;

         border: 1px solid #ccc;

         border-radius: 5px;

         padding: 20px;

         box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);

     }

 

     .container h2 {

         text-align: center;

         margin-bottom: 20px;

     }

 

     .container input, .container textarea {

         width: 100%;

         padding: 10px;

         margin-bottom: 10px;

         border: 1px solid #ccc;

         border-radius: 5px;

     }

 

     .container button {

         width: 100%;

         padding: 10px;

         background-color: #007bff;

         color: #fff;

         border: none;

         border-radius: 5px;

         cursor: pointer;

     }

 

     .container button:hover {

         background-color: #0056b3;

     }

 

     .results {

         margin-top: 20px;

     }

 

     .results textarea {

         width: 100%;

         height: 200px;

         padding: 10px;

         border: 1px solid #ccc;

         border-radius: 5px;

     }

</style>

</head>

<body>

<div class="container">

     <h2>Sitemap Generator</h2>

     <textarea id="urls-input" placeholder="Masukkan URL (satu per baris)"></textarea>

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

     <div class="results" id="results">

         <textarea id="sitemap-output" readonly></textarea>

     </div>

</div>

 

<script>

     function generateSitemap() {

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

         const sitemapTemplate = `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n`;

         let sitemapContent = urls.map(url => `  <url>\n <loc>${url}</loc>\n  </url>`).join('\n');

         sitemapContent = sitemapTemplate + sitemapContent + '\n</urlset>';

         document.getElementById('sitemap-output').value = sitemapContent;

     }

</script>

</body>

</html>