How to create a Google XML Sitemap bbPress

Building Developer's Forum I wanted to create a XML Sitemap for it.

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";

Line 16, put your own domain:

$generator="http://EXAMPLE.com";

Line 89, put your own domain again:

fwrite($handle, ' http://EXAMPLE.com');

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, '');
fwrite($handle, ' http://EXAMPLE.com/');
fwrite($handle, ' '.date("Y-m-d").'');
fwrite($handle, ' daily');
fwrite($handle, ' 1.0');
fwrite($handle, '
');

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 πŸ˜‰

About Rick

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

Leave a Reply

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

*
*