Make google happy and remove "duplicate content" despite canonical link

This commit is contained in:
2022-12-28 19:40:56 +01:00
parent aae719d025
commit 2976176ecb
10 changed files with 1192 additions and 1198 deletions

View File

@ -8,25 +8,25 @@ try{
}
$links = [];
$links []= ['loc' => CANONICAL_URL . '/test.php', 'changefreq' => 'weekly', 'priority' => '0.8'];
$links []= ['loc' => CANONICAL_URL . '/onions.php', 'changefreq' => 'daily', 'priority' => '1'];
$links []= ['loc' => CANONICAL_URL . '/onions.php?format=json', 'changefreq' => 'daily', 'priority' => '0.2'];
$links []= ['loc' => CANONICAL_URL . '/onions.php?format=text', 'changefreq' => 'daily', 'priority' => '0.2'];
$links []= ['loc' => CANONICAL_URL . '/', 'changefreq' => 'daily', 'priority' => '1'];
$links []= ['loc' => CANONICAL_URL . '/?format=json', 'changefreq' => 'daily', 'priority' => '0.2'];
$links []= ['loc' => CANONICAL_URL . '/?format=text', 'changefreq' => 'daily', 'priority' => '0.2'];
$admin_approval = '';
if(REQUIRE_APPROVAL){
$admin_approval = PREFIX . 'onions.approved = 1 AND';
}
foreach (LANGUAGES as $lang_code => $data){
$links []= ['loc' => CANONICAL_URL . "/test.php?lang=$lang_code", 'changefreq' => 'weekly', 'priority' => '0.4'];
$links []= ['loc' => CANONICAL_URL . "/onions.php?lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.5'];
$links []= ['loc' => CANONICAL_URL . "/?lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.5'];
$stmt=$db->prepare('SELECT COUNT(*) FROM ' . PREFIX . "onions WHERE $admin_approval category=? AND address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND timediff<604800;');
foreach($categories as $cat => $name){
$links []= ['loc' => CANONICAL_URL . "/onions.php?cat=$cat&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3'];
$links []= ['loc' => CANONICAL_URL . "/?cat=$cat&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3'];
$stmt->execute([$cat]);
$num=$stmt->fetch(PDO::FETCH_NUM);
$pages=ceil($num[0]/PER_PAGE);
if($pages > 1) {
while ( $pages > -1 ) {
$links [] = [ 'loc' => CANONICAL_URL . "/onions.php?cat=$cat&pg=$pages&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3' ];
$links [] = [ 'loc' => CANONICAL_URL . "/?cat=$cat&pg=$pages&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3' ];
--$pages;
}
}
@ -38,7 +38,7 @@ foreach (LANGUAGES as $lang_code => $data){
];
$cat=count($categories);
foreach($special as $query){
$links []= ['loc' => CANONICAL_URL . "/onions.php?cat=$cat&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3'];
$links []= ['loc' => CANONICAL_URL . "/?cat=$cat&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3'];
if($cat===count($categories)+1){
$num[0]=PER_PAGE;
}else{
@ -47,13 +47,13 @@ foreach (LANGUAGES as $lang_code => $data){
$pages=ceil($num[0]/PER_PAGE);
if($pages > 1) {
while ( $pages > -1 ) {
$links [] = [ 'loc' => CANONICAL_URL . "/onions.php?cat=$cat&pg=$pages&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3' ];
$links [] = [ 'loc' => CANONICAL_URL . "/?cat=$cat&pg=$pages&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3' ];
--$pages;
}
}
++$cat;
}
$links []= ['loc' => CANONICAL_URL . "/onions.php?cat=$cat&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3'];
$links []= ['loc' => CANONICAL_URL . "/?cat=$cat&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3'];
}
$dom = new DOMDocument('1.0', 'UTF-8');
try {