Introduction

The Sitemap is a protocol that developers can use to publish lists of links from across their websites. Sitemap files contains URLs of pages so that spiders, also known as crawlers, can find them. All the major search engines (Google, Bing, Yahoo, Ask..) use this protocol that lets them have updated page information. The benefits to using sitemap can be summarized as follows:
  • Search engines find and index pages faster even if your site is new and will be alerted whenever your content is modified
  • It boosts your SEO especially if you are using canonical URLs (supported by Mercury) in multi-language websites
Mercury is capable of generating XML sitemap for news, blog posts, lab entries and articles of documentation.

Implementation

Mercury automatically generates the sitemap on a daily basis with the Cron Job of WHMCS including only published contents. The file is stored in the following path:

{WHMCS_PATH}/modules/addons/Mercury/core/Mercury_Admin/resources/sitemap/sitemap.xml

If you can't see it probably you've recently installed Mercury or there are no contents published yet. In the meantime you can start adding the sitemap to your robots.txt file. This file should be placed in the root directory of your site with the following declaration:

Sitemap: {WHMCS_PATH}/modules/addons/Mercury/core/Mercury_Admin/resources/sitemap/sitemap.xml

Don't forget to replace {WHMCS_PATH} with your URL (eg. https://katamaze.com). Moreover consider to submit your sitemap directly to Google & Bing with their Webmaster Tools.

XML Structure

Mercury natively supports multilingual sitemaps and stores lastmod (if available) in XML format. For more details about the structure of the XML sitemap, take a look at the screenshot below.

Aliases and multiple Domains

In case you use multiple domains or aliases to provide multilingual contents like we do (katamaze.com for English and katamaze.it for Italian), you can override the default SystemURL of WHMCS like follows. Open this file:

{WHMCS_PATH}/modules/addons/Mercury/core/Mercury_Admin/resources/sitemap/systemurl.json

Here you'll find a structure like this:

{
    "arabic" : "",
    "azerbaijani" : "",
    "bulgarian" : ""
}


In the same directory create a new file named exactly dist.systemurl.json and add as many key-value pairs as you need. Let us make an example using our scenario. The default URL of our WHMCS is katamaze.com but we provide localised contents to Italian vistors from katamaze.it. Our dist.systemurl.json looks like follows:

{
    "italian" : "https://katamaze.it/"
}


This way contents written in Italian will use the domain katamaze.it instead of katamaze.com. Do not edit systemurl.json and don't put a comma after the last item.

Static URL

Mercury adds news, blog posts, lab entries and articles of documentation in sitemap but you can also manually add URLs. Open this file:

{WHMCS_PATH}/modules/addons/Mercury/core/Mercury_Admin/resources/sitemap/staticurl.json

Here you'll find an example that shows you how to add URLs to sitemap. Use the same structure to creare your own list of URLs creating a new file named exactly dist.staticurl.json. Keep in mind that special characters like &, <, > etc. should be escaped with HTML entities.