par
blinz » 16 juin 2016, 20:54
Pourquoi chercher à faire compliqué.
Merci
Pour ceux que ça peut aider.
J'ai fait un système pour indiquer à google qu'il ne faut pas prendre en compte les balise titles de la pagination afin d'éviter le duplicate content.
Recommandation de google à cette adresse :
https://support.google.com/webmasters/a ... 3744?hl=fr
<?php $monUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?><link rel="canonical" href="<?php echo $monUrl ; ?>" />
<?php
$system_pagination = str_replace('.html' ,'',$monUrl);
// Indication à google pour les balise prev & next
// Si il n'y a pas de page ( pagination )
if (empty($_GET['page'])) {
echo '<link rel="next" href="'.$system_pagination.'-page-2.html">';
// Si on est sur page ( pagination )
}else{
$system_pagination = str_replace('-page-'.$_GET['page'].'.html' ,'',$monUrl);
echo '<link rel="prev" href="'.$system_pagination.'-page-'.($_GET['page']-1).'.html">';
echo '<link rel="next" href="'.$system_pagination.'-page-'.($_GET['page']+1).'.html">';
}
?>
En espérant que ça servira à d'autres
Pourquoi chercher à faire compliqué.
Merci ;)
Pour ceux que ça peut aider.
J'ai fait un système pour indiquer à google qu'il ne faut pas prendre en compte les balise titles de la pagination afin d'éviter le duplicate content.
Recommandation de google à cette adresse : [url]https://support.google.com/webmasters/answer/1663744?hl=fr[/url]
[php]<?php $monUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?><link rel="canonical" href="<?php echo $monUrl ; ?>" />
<?php
$system_pagination = str_replace('.html' ,'',$monUrl);
// Indication à google pour les balise prev & next
// Si il n'y a pas de page ( pagination )
if (empty($_GET['page'])) {
echo '<link rel="next" href="'.$system_pagination.'-page-2.html">';
// Si on est sur page ( pagination )
}else{
$system_pagination = str_replace('-page-'.$_GET['page'].'.html' ,'',$monUrl);
echo '<link rel="prev" href="'.$system_pagination.'-page-'.($_GET['page']-1).'.html">';
echo '<link rel="next" href="'.$system_pagination.'-page-'.($_GET['page']+1).'.html">';
}
?>[/php]
En espérant que ça servira à d'autres