Code Test

Uncategorized
2. Nov 2023
124 views

Img test tiny

just a test code:

 

<script>
function generateSitemap() {
// Get the URLs from the textarea
const urlsTextarea = document.getElementById('urls');
const urls = urlsTextarea.value.trim().split('\n');

// Generate the XML sitemap
const xmlSitemap = generateXmlSitemap(urls);

// Display the result
const resultElement = document.getElementById('result');
resultElement.textContent = xmlSitemap;
}

function generateXmlSitemap(urls) {
// Create a new XML document
const xmlDoc = document.implementation.createDocument(null, 'urlset', null);
xmlDoc.documentElement.setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');

// Loop through each URL and create a <url> element
for (const url of urls) {
const urlElement = xmlDoc.createElement('url');
const locElement = xmlDoc.createElement('loc');
locElement.appendChild(xmlDoc.createTextNode(url));
urlElement.appendChild(locElement);
xmlDoc.documentElement.appendChild(urlElement);
}

// Serialize the XML document to a string
const serializer = new XMLSerializer();
const xmlString = serializer.serializeToString(xmlDoc);

return xmlString;
}
</script>

 

<!-- Inside the menu-drawer div in HTML -->
<div class="menu-icon">&#9776;CCTEST</div>
Banner space[article middle]

Comments

No comments has been added on this post

Add new comment

You must be logged in to add new comment. Log in