XML sitemap add-on for sNews
Here is an add on for sNews CMS v1.7 to generate a valid XML sitemap for search engines to use. If you're not familiar with XML sitemaps, you should read up at sitemaps.org. Sitemaps are an extremely useful way for search engines to index all of your content.
The way this sitemap mod is set up, you can simply edit the variables in the script and drop it on your server and it should work. There is some optional extended functionality covered at the end of this article as well.
Set it up
To get started, download & extract the file;
Now edit the variables to match your site;
$server = 'localhost'; $dbuser = ''; $dbpass = ''; $dbname = ''; $dbprefix = ''; $site = 'http://www.mysite.com';
That's it! Now upload to your site, preferably in the root public_html directory. Now visit the page and you should see the XML sitemap generated from your articles, categories & pages.
Extending the sitemap mod
As I use this sitemap mod on my sNews sites, I have added a "last modified" field to my articles table, so that when I edit an article, the last modified time is reflected within the sitemap. Adding this functionality is quite easy. To start with, you need to add the field to your database, so open up PhPMyAdmin or whatever DB tool you use and add the column;
ALTER TABLE articles ADD last_mod datetime NULL;
Now you just need to edit your snews.php file to update the last_mod field when you edit your articles. Open your snews.php file, and within the function processing, around line 2951, find the following;
artorder = '$artorder'
Now replace it with this;
artorder = '$artorder', last_mod = NOW()
Upload your edited snews.php file and now when you edit an article it should update that field and the sitemap.php add-on file will reflect the changes.
Notify the search engines
Don't forget to notify the search engines! Add your sitemap to:
And while you're at it, add the sitemap location to your robots.txt file;