Automatically Creating WHMCS Knowledgebase Sitemaps

WHMCS is a client management, billing, and support solution and is widely used as the back end system to manage Web Hosting sites. WHMCS includes a built in knowledge base system where the administrator can create categories and articles to support clients in performing common web hosting tasks. In version 4.1.1 of WHMCS, the ability to use Search Engine Optimized (SEO) file names from the knowledge base (KB) is available. Creating sitemaps for theses were often tedious and error prone since each sitemap entry had to be added manually from the KB article title. This article describes the WHMCS admin add on module to overcome this manual entry and automatically generate the sitemap file from the WHMCS database entries.

A sitemap file is an XML file that defines the pages that you provide to search engines that you specify the files that are to be indexed in your site.  By using this protocol, you specify the exact pages that want the search engines to find, even though they may be database driven, or difficult to find through deep links on your site.  Sitemap files can be indexes where they contain a list of other sitemap files or sitemap entries containing links to web pages.  More information on the sitemaps protocol can be found at sitemaps.org.

This add on reads the knowledge base categories and articles from the WHMCS database tables and generates a list of the SEO titles from those table entries in a sitemap entry file.  It then reads the specified sitemap file, if it exists, and matches up the database table entries with the entries in the sitemap file.  If there are KB categories or articles that are not included in the sitemap file, the WHMCS admin is given the ability to add the articles to the sitemap file.  If the categories and articles are already in the sitemap file, then the WHMCS admin has the ability to update the timestamp in the sitemap file or remove the item from the sitemap file entirely.  The sitemap file can also contain additional static entries that will be listed in a separate table at the bottom of the page.   The WHMCS admin then has the ability to remove or update the timestamps on the static items.

The problem with creating sitemap entries from the WHMCS database is that the KB articles and categories are generated from the database versus stored as files in the file system which would contain timestamps of when the file was last written.  The WHMCS database does not store the time the article or category is updated so there is no way to know when the last update to the article was made.  To overcome this in the add on, the WHMCS admin must manually specify when to update the sitemap lastmod time of the articles by checking the box in the update column and re-generating the sitemap file.

To access this WHMCS module, the admin logs in and selects the Addon Modules menu item under the Utilities Menu.  From there, they are presented with a list of add on modules available.  If the KB Sitemap Generator was installed correctly, the module is listed as Kb Sitemap Gen.  Clicking on this title will access the module, which first must be installed.  To install, select the button that says “Install”.  This will create an additional WHMCS database table which will hold the sitemap file name.

Once the add on module is installed, the module presents three general areas of information. 1) WHMCS and Sitemap File information, 2) Table to manage WHMCS KB database data in the sitemap file, and 3) Table to manage static sitemap tables.

The WHMCS and Sitemap File information shows the WHMCS Root Path which is the path WHMCS believes it is installed in.  This URL path will be used to generate the URL in the sitemap file.  The next entry in this area shows the file path that the sitemap file will be created or exists in.  It defaults to the path where WHMCS is installed plus the file name “kbsitemap.xml”.  The file name and location can be changed by entering optional additional path information and file name and pressing the “Set File” button.  This will cause the add on module to store the new file location in its database table and will be available for future use of the module.  The input box will accept additional path information as well, so the sitemap file could reside in a different location.  For example setting the file to ../kbsitemap.xml will generate a sitemap file one directory higher than the WHMCS install directory.

The “Files From WHMCS KB Database” table lists the Type, URL , LastMod, and three check boxes to Add, Update, or Remove the item.  The Type is whether the item is a Category or an Article and each type is displayed with a different color in the table.  The URL is the address that is generated from the WHMCS installed directory plus the knowledge base sub-directory, plus the category or article id from the database, and finally the SEO friendly filename generated from the title or name of the article or category.  The LastMod column is the LastMod time from the sitemap if the item is in the sitemap, otherwise it is empty if it has not been generated.  The three check box columns allow the admin to manage the items in the sitemap file and all changes are made when the user presses the “Make Changes To Sitemap” button at the bottom of the admin module.  If the item is already in the sitemap file, the Add check box will be disabled and if the item is not yet in the sitemap file, the Update and Remove check boxes will be disabled.

The following image shows the WHMCS and Sitemap File Information as well as the begining of the table that lists the Files From WHMCS KB database.

KB Sitemap Generator Top Half

KB Sitemap Generator Top Half

 

In addition to the sitemap information generated from the WHMCS database, this add on module can also manage additional static sitemap file information.  Beneath the Files From WHMCS KB Database area, the add on module will display sitemap entries that are not generated from the WHMCS knowledge base database tables.  These could include static entries or KB article and category that were manually entered and contained spelling or format errors.  The image below shows several entries that were static entries for the affiliates, tutorials, downloads, and announcements pages.  From this table the admin can Update or Remove the items in the sitemap file.

The image below shows the bottom of the WHMCS KB database table items as well as the static sitemap items.

KB Sitemap Generator Bottom Half

KB Sitemap Generator Bottom Half

Now you can add your automatically generated sitemap to a sitemap index file.  For more information on using sitemaps and sitemap index files, click on the link to the article ”Building A Comprehensive Sitemap for SEO” in our blog.

This add on was developed for WHMCS version 4.1.1. 

You can download the script as a zip file for free in our shop by following this link.  Installation instructions can be found in the text file contained in the zip file.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • Socialogs
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Buzz

Respond to this post