Pour utiliser ce plan sitemap, il faut d'abord avoir installé le mod NewPunReWrite ou alors PunOOgle.
Il suffit de créé un nouveau fichier sitemap.php avec le code ci-dessous dedans puis d'uploader ce fichier à la racine de votre forum.
Vous obtiendrez alors un plan sitemap compatible avec Google.
<?php /*************************************************************************** * sitemap.php pour NewPunReWrite * ------------------- * * Modified by keyes - http://placelibre.ath.cx/keyes/ * Re-Modified by Tcheval - http://www.tcheval.net * * Based on the script originally by http://www.pentapenguin.com * and modified by Smartys for use with PunBB * Last Modified: 11/27/05 * * NOTE: Use ONLY if you have installed the NewPunReWrite PunBB mod! * If you do NOT have this mod installed, please use the Google * Sitemap Generator by Smartys at http://www.punres.org/desc.php?pid=90 * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ define('PUN_QUIET_VISIT', 1); define('PUN_ROOT', './'); require PUN_ROOT.'include/common.php'; // false = write to file, true = dynamic $dynamic = true; // This only matters if you're writing to the file $filename = 'sitemap.xml'; // Obtenir les messages $result = $db->query('SELECT t.id as topic_id, subject, last_post, sticky FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL ORDER BY last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); // Obtenir les forums $result2 = $db->query('SELECT f.id as forum_id, forum_name, last_post FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY f.id DESC') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); $output = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n"; $output .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n"; // Informations du Forum $output .= "<url>\n"; $output .= "\t<loc>".$pun_config['o_base_url']."/" . "</loc>\n"; $output .= "\t<lastmod>".gmdate('Y-m-d\TH:i:s+00:00', time())."</lastmod>\n"; $output .= "\t<priority>1.0</priority>\n"; $output .= "</url>\n\n"; // Génération des liens des forums while ($cur_forum = $db->fetch_assoc($result2)) { $lastmodified = gmdate('Y-m-d\TH:i:s+00:00', $cur_forum['last_post']); $viewforum = 'forum-'.$cur_forum['forum_id'].'-'.pun_url($cur_forum['forum_name']); $priority = '1.0'; $output .= "<url>\n"; $output .= "\t<loc>".$pun_config['o_base_url']."/$viewforum</loc>\n"; $output .= "\t<lastmod>$lastmodified</lastmod>\n"; $output .= "\t<priority>$priority</priority>\n"; $output .= "</url>\n\n"; } // Génération des liens des messages while ($cur_topic = $db->fetch_assoc($result)) { $lastmodified = gmdate('Y-m-d\TH:i:s+00:00', $cur_topic['last_post']); $viewtopic = 'sujet-'.$cur_topic['topic_id'].'-'.pun_url($cur_topic['subject']); $priority = ($cur_topic['sticky'] == '1') ? '1.0' : '0.5'; $output .= "<url>\n"; $output .= "\t<loc>".$pun_config['o_base_url']."/$viewtopic" . ".html</loc>\n"; $output .= "\t<lastmod>$lastmodified</lastmod>\n"; $output .= "\t<priority>$priority</priority>\n"; $output .= "</url>\n\n"; } $output .= "</urlset>\n"; // If we chose dynamic, we output the sitemap // Otherwise, we write it to the file if ($dynamic) { header('Content-type: application/xml'); echo $output; } else { $file = fopen($filename, "w"); fwrite($file, $output); fclose($file); echo "Done"; } ?>