A simple library to autogenerate xml sitemaps for your codeigniter application
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Sitemaps for CodeIgniter

codeigniter-sitemaps allows you to generate XML sitemaps for your codeigniter based applications quickly and easily.

Basic autodetection of pages is included using auto_detect() which assumes method == page and adds urls to the sitemap accordingly, this can be restricted using the exclude parameter.

Please feel free to contribute or file bugs.

The directory you're writing the sitemap to must be writable.

System Requirements

  • Codeigniter 2.0+
  • PHP5.3 is required for ISO 8601 date compatibility.


Put the contents of this archive in your system/application folder.

Or use sparks:

php tools/spark install codeigniter-sitemaps

Example Usage

//if you're using sparks


//assuming a hypothetical posts_model
$posts = $this->posts_model->get_posts();

    foreach ($posts AS $post)
        $item = array(
            "loc" => site_url("blog/" . $post->slug),
            "lastmod" => date("c", strtotime($post->last_modified)),
            "changefreq" => "hourly",
            "priority" => "0.8"


// file name may change due to compression
$file_name = $this->sitemaps->build("sitemap_blog.xml");

$reponses = $this->sitemaps->ping(site_url($file_name));

There is also autodetect functionality see code & comments for more details


This library is based on work by Philipp Dörner 2010 http://signalkraft.com/google-sitemaps-for-codeigniter