motorscript.com

Sitemap for SMF with Pretty URLs

Published:
Updated:
Note: This is an archived post. Information may not be relevant now.

This is a PHP script that generates a sitemap file from an SMF installation with PrettyURLs mod, which is a must-have SEO package. The generated XML can be submitted to Google via Google Webmaster Tools.

The script is very much the http://code.google.com/p/smf-pretty-sitemap itself. It has been modified to work with the latest version of SMF and PrettyURLs. The raw modifications can be seen in this commit https://github.com/xtranophilist/sitemap-for-smf/commit/d9501e85b4704860f24b58acf1dabefbb1bc7e46

Native mysql_query is used instead of SMF's db_query (or the latest $smcFunc['db_query']). The database field names have been corrected to match the latest version of SMF. Support for search-engine friendly URLs for member profiles (e.g. http://mysite.com/profile/username) has been added. Users may switch to not-pretty URLs (e.g. http://mysite.com/index.php?action=profile;u=2 ) by modifying the boolean value $sef_member_profile to FALSE at the start of the script. Also, the retrieval of pretty URLs for topics had to be corrected by adding the get_pretty_url_by_topic_id() method.

Tested against one live forum and it works fine, zero errors or warnings from Google Webmaster Tools.

Gist on Github:
https://gist.github.com/4683396

Raw PHP File :
https://raw.github.com/gist/4683396