How to create a Google XML Sitemap bbPress

I found the solution here but I tweak it a little more.

1. Download the Plugin

It is not in the official repository so I uploaded it here for you:

bbpres_google_sitemap.zip

2. Upload the file

Place the file into your my-plugins folder.

3. Activate it

Yes, of course. Activate the plugin from your admin panel πŸ˜‰

4. Edit config lines

Line 13, add folder or change the file location if needed:

$sitemap_file = $_SERVER['DOCUMENT_ROOT']."/sitemap.xml";
Code language: PHP (php)

Line 16, put your own domain:

$generator="http://EXAMPLE.com";
Code language: PHP (php)

Line 89, put your own domain again:

fwrite($handle, ' <loc>http://EXAMPLE.com</loc>');
Code language: HTML, XML (xml)

My Changes

I added:

1. Added a DESC to the MySQL query, better sorted by date (line 31).

2. Added the forum home page to the sitemap:

fwrite($handle, '<url>'); fwrite($handle, ' <loc>http://EXAMPLE.com/</loc>'); fwrite($handle, ' <lastmod>'.date("Y-m-d").'</lastmod>'); fwrite($handle, ' <changefreq>daily</changefreq>'); fwrite($handle, ' <priority>1.0</priority>'); fwrite($handle, '</url>');
Code language: PHP (php)

Extra

The plugin creates the Sitemap every time a new topic has been made. And also creates it when somebody updates (1 chance of 10, random).

I would like to test this plugin in a very busy site. Maybe you have to also configure the "random creation" when a new topic is created.

I will depend on the server resources I guess.

Feel free to post any comments or suggestions πŸ˜‰

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*