Sitemap Generator
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
h1 {
margin: 0;
}
main {
padding: 20px;
}
form {
display: flex;
flex-direction: column;
margin-bottom: 20px;
}
label {
margin-bottom: 10px;
}
input[type=url] {
padding: 10px;
border-radius: 5px;
border: none;
margin-bottom: 10px;
}
button[type=submit] {
background-color: #333;
color: #fff;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
button[type=submit]:hover {
background-color: #555;
}
#output {
display: none;
margin-top: 20px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
@media screen and (min-width: 768px) {
main {
max-width: 768px;
margin: auto;
}
}
function generateSitemap() {
// Get the URL input value
var url = document.getElementById("url").value;
// Check if the URL starts with "http://" or "https://"
if (!url.startsWith("http://") && !url.startsWith("https://")) {
alert("Please enter a valid URL starting with 'http://' or 'https://'");
return;
}
// Show the output div
var outputDiv = document.getElementById("output");
outputDiv.style.display = "block";
// Create the sitemap link and append it to the output div
var sitemapLink = document.createElement("a");
sitemapLink.href = url + "/sitemap.xml";
sitemapLink.target = "_blank";
sitemapLink.textContent = "Click here to view the sitemap";
outputDiv.appendChild(sitemapLink);
}