'); // Menambahkan URL ke file sitemap foreach ($entries as $entry) { // Mengganti spasi dengan tanda plus $formattedEntry = str_replace(' ', '+', $entry); $url = $sitemap->addChild('url'); $url->addChild('loc', $baseUrl . $basePath . '/?id_ID=' . $formattedEntry); $url->addChild('lastmod', date('Y-m-d')); $url->addChild('changefreq', 'daily'); $url->addChild('priority', '0.5'); } // Menyimpan file sitemap di direktori yang sama dengan skrip $sitemapFilePath = $directoryPath . '/sitemap.xml'; $sitemap->asXML($sitemapFilePath); // Output ke browser header('Content-Type: application/xml'); echo $sitemap->asXML(); ?>