$base . '/', 'changefreq' => 'weekly', 'priority' => '1.0', 'lastmod' => date('Y-m-d'), ], [ 'loc' => $base . '/faq.php', 'changefreq' => 'weekly', 'priority' => '0.8', 'lastmod' => date('Y-m-d'), ], [ 'loc' => $base . '/about.php', 'changefreq' => 'monthly', 'priority' => '0.6', 'lastmod' => date('Y-m-d'), ], [ 'loc' => $base . '/how-it-work.php', 'changefreq' => 'monthly', 'priority' => '0.6', 'lastmod' => date('Y-m-d'), ], [ 'loc' => $base . '/contact.php', 'changefreq' => 'monthly', 'priority' => '0.6', 'lastmod' => date('Y-m-d'), ], ]; // ========================= // Pages catégories SEO // ========================= $categorySlugs = [ 'avocat', 'consultant', 'medecin', 'psychologue', 'professeur', 'comptable', 'traducteur', 'notaire', 'guide', 'agent-immobilier', 'autres-specialistes', ]; foreach ($categorySlugs as $slug) { $urls[] = [ 'loc' => $base . '/recherche/' . $slug . '/', 'changefreq' => 'daily', 'priority' => '0.9', 'lastmod' => date('Y-m-d'), ]; } // ========================= // Profils spécialistes actifs // ========================= $sql = " SELECT id, prenom, nom, ville, specialite, updated_at FROM praticien WHERE date_expiration IS NOT NULL AND date_expiration >= DATE_SUB(NOW(), INTERVAL 14 DAY) "; $stmt = $pdo->query($sql); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($rows as $p) { $specSlug = 'specialiste'; if (! empty($p['specialite'])) { $specDb = mb_strtolower(trim((string) $p['specialite']), 'UTF-8'); foreach (seo_spec_map() as $slug => $cfg) { $dbVal = mb_strtolower(trim((string) ($cfg['db'] ?? '')), 'UTF-8'); if ($dbVal === $specDb || ($dbVal !== '' && mb_stripos($specDb, $dbVal, 0, 'UTF-8') === 0)) { $specSlug = $slug; break; } } } $citySlug = ! empty($p['ville']) ? seo_city_slug_from_input((string) $p['ville']) : 'france'; $nameSlug = seo_slug(trim((string) ($p['prenom'] ?? '') . ' ' . (string) ($p['nom'] ?? ''))); if ($nameSlug === '') { $nameSlug = 'profil'; } $loc = $base . '/specialistes/' . rawurlencode($specSlug) . '/' . rawurlencode($citySlug) . '/' . rawurlencode($nameSlug . '-' . (int) $p['id']) . '/'; $lastmod = date('Y-m-d'); if (! empty($p['updated_at'])) { $ts = strtotime((string) $p['updated_at']); if ($ts) { $lastmod = date('Y-m-d', $ts); } } $urls[] = [ 'loc' => $loc, 'changefreq' => 'weekly', 'priority' => '0.8', 'lastmod' => $lastmod, ]; } // ========================= // Sortie XML // ========================= echo '' . "\n"; echo '' . "\n"; foreach ($urls as $url) { echo " \n"; echo ' ' . xml_escape($url['loc']) . "\n"; if (! empty($url['lastmod'])) { echo ' ' . xml_escape($url['lastmod']) . "\n"; } echo ' ' . xml_escape($url['changefreq']) . "\n"; echo ' ' . xml_escape($url['priority']) . "\n"; echo " \n"; } echo '';