par
blinz » 03 avr. 2016, 00:36
Salut à tous.
J'ai un script qui permet de créer mon site map mais après l'analyse et la soumission sur search console,
google me dit
erreur:
Votre sitemap semble correspondre à une page HTML. Veuillez utiliser un format de sitemap pris en charge
PS: mon fichier est bien enregistré en sitemap_ville.xml
et la déclaration en robot.txt est:
User-Agent: *
Allow: /
Sitemap:
http://monsite.fr/sitemap_ville_2.xml
Sitemap:
http://monsite.fr/sitemap_departement.xml
Qu'est ce que je ne fait pas bien svp.
Merci à vous
<?php
set_time_limit(0);
$sitemap = "SELECT DISTINCT city FROM `type`";
$req = $bdd->query($sitemap);
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml.= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
while ($ligne = $req->fetch(PDO::FETCH_ASSOC)) {
$xml.= '<url>' . "\n";
// toutes les villes avec les diff
$xml.= ' <loc>http://monsite.fr/actu-de-'.simplification($ligne['city']).'.html</loc>' . "\n";
$xml.= ' <changefreq>daily</changefreq>' . "\n";
$xml.= ' <priority>0.9</priority>' . "\n";
$xml.= '</url>' . "\n";
}
$xml.= '</urlset>';
echo $xml;
?>
Le code renvoi donc
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://monsite.fr/actu-de-mornac.html</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>http://monsite.fr/actu-de-pennautier.html</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
</urlset>
Salut à tous.
J'ai un script qui permet de créer mon site map mais après l'analyse et la soumission sur search console,
google me dit [b]erreur[/b]:
Votre sitemap semble correspondre à une page HTML. Veuillez utiliser un format de sitemap pris en charge
[b]PS: [/b] mon fichier est bien enregistré en sitemap_ville.xml
et la déclaration en robot.txt est:
User-Agent: *
Allow: /
Sitemap: http://monsite.fr/sitemap_ville_2.xml
Sitemap: http://monsite.fr/sitemap_departement.xml
Qu'est ce que je ne fait pas bien svp.
Merci à vous
[php]<?php
set_time_limit(0);
$sitemap = "SELECT DISTINCT city FROM `type`";
$req = $bdd->query($sitemap);
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml.= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
while ($ligne = $req->fetch(PDO::FETCH_ASSOC)) {
$xml.= '<url>' . "\n";
// toutes les villes avec les diff
$xml.= ' <loc>http://monsite.fr/actu-de-'.simplification($ligne['city']).'.html</loc>' . "\n";
$xml.= ' <changefreq>daily</changefreq>' . "\n";
$xml.= ' <priority>0.9</priority>' . "\n";
$xml.= '</url>' . "\n";
}
$xml.= '</urlset>';
echo $xml;
?>[/php]
Le code renvoi donc
[html]<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://monsite.fr/actu-de-mornac.html</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>http://monsite.fr/actu-de-pennautier.html</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
</urlset>[/html]