First Commit

This commit is contained in:
Christian Torbidone 2024-08-01 15:26:32 +02:00
parent 260fe4727e
commit c9ef9cbd0c
2 changed files with 15 additions and 28 deletions

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2024-07-01</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.example.com/about</loc>
<lastmod>2024-07-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.example.com/contact</loc>
<lastmod>2024-07-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>

View file

@ -3,12 +3,20 @@ package org.thundernetwork.sitemap
import org.thundernetwork.sitemap.models.UrlEntry import org.thundernetwork.sitemap.models.UrlEntry
fun main() { fun main() {
val urlEntries = listOf( val large = true // Imposta questo valore in base alle tue esigenze
UrlEntry("https://www.example.com/", "2024-07-01", "monthly", 1.0), val path = "sitemaps.xml" // Imposta il percorso dove salvare le sitemaps
UrlEntry("https://www.example.com/about", "2024-07-01", "monthly", 0.8),
UrlEntry("https://www.example.com/contact", "2024-07-01", "monthly", 0.8)
)
val generator = SitemapGenerator(urlEntries) val generator = SitemapGenerator(large, path)
generator.generateSitemap("sitemap.xml")
// Carica una sitemap esistente
generator.loadSitemap("sitemap.xml")
// Aggiungi nuovi URL
generator.addUrl(UrlEntry("https://www.example.com/about", "2024-08-01", "weekly", 0.9))
// Rimuovi un URL
generator.removeUrl("https://www.example.com/old-page")
// Genera la sitemap aggiornata
generator.generateSitemap()
} }