XML sitemap add-on for sNews CMS v1.7
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;
Sitemap: http://www.mysite.com/sitemap.php
Comments
RSS Comments Feed
Jonathan
Jonathan
Matt
I'll leave them up, just so I can expand on this for others who may be confused by what this add-on does.
The HTML sitemap generated by sNews is an overview listing of pages & articles. While this is a handy overview for humans to use to navigate your site, it doesn't contain the same information as an XML sitemap.
An XML sitemap (such like this add-on produces) is just an easy machine-readable way to feed page information to the search engines, with detailed priorities, last edit dates, etc.
They work in conjuction, one doesn't replace the other.
Thanks!