Rah's Sitemap

Rah_sitemap is a sitemap plugin for Textpattern CMS. Easily build valid Sitemap.org XML sitemaps for search engines, including Google. Supports categories, sections, articles and even custom URLs. All settings can be managed from clean interface. No dive to code required.


Version 1.2 Mar 09, 2011
Other versions...

A cup of coffee
via PayPal

List of features

  • Simple interface under Textpattern > Extensions > Sitemap: build, view, modify and customize sitemap.
  • Filter, include and exclude section, category and article URLs from the sitemap.
  • Create and insert custom URLs to the sitemap with couple simple clicks.
  • No need to create files nor set permissions, instead just use the plugin and eventually submit the sitemap URL to Google (via Webmaster tools) or other searh engine.
  • Sitemap is automatically gzipped as much as possible — at least if server supports gzipping.



  • Textpattern 4.0.7+
  • PHP 5+ (or 4.3.0 when custom timestamp format is used)
  • Optional: PHP zlib extension


  • Textpattern 4.0.8+
  • PHP 5.1.2+

Installation and usage

The general behavior stands: paste the plugin code to the plugin installer textarea and run the automatic setup. Then just activate the plugin and you are ready to use the sitemap.

You can locate rah_sitemap’s user-interface panel from Textpattern > Extensions > Sitemap. From there you can modify preferences and view the sitemap.

Rah_sitemap version 0.4 included a new feature: permlink settings. These setting, found in the panel, will let you define the permlink form for the URLs in the Sitemap. This is a ideal tool for matching the URLs to your own .httaccess rules or a plugin created custom URL rules. If you want to use in-build urls defined by Textpattern itself, you can leave these setting unset.

Article permlinks

These URL settings are used for articles that appear in the sitemap. To form the URLs you can use any individual article context’s <txp:/> tag. Big shots like <txp:permlink />, <txp:posted />, <txp:title />, <txp:category1 />, <txp:category2 />, <txp:section />, <txp:if_article_author />, <txp:if_article_category />, <txp:if_article_id /> and so on.

Example Article permlink URL:

<txp:site_url />sections/<txp:section/>/articles/<txp:article_id />/<txp:article_url_title />
Category permlinks

These URL settings are used for Category links that appear in the sitemap. To form the URLs you can use plain category context TXP tags <txp:category /> and <txp:if_category />. The plugin also provides two extra tagish tags, [type] and [id] which will basically output category’s type and id.

Example Category permlink URL:

<txp:site_url />view/category/[id]/<txp:category link="0" title="0" />
Section permlinks

These URL settings are used for section links that appear in the sitemap. To form the URLs you can use the two section tags, <txp:section /> and <txp:if_section />.

<txp:site_url />section/<txp:section />


Version 1.2

  • Added: adds site URL to relative article permlinks. Basically a fix for gbp_permanent_links.
  • Changed: from permlinkurl_id() to permlinkurl(). Greatly reduced the amount of queries generating article permlinks makes.

Version 1.1

Version 1.0

  • Slightly changed backend’s installer call; only check for installing if there is no preferences available.

Version 0.9

  • Fixed: now correctly parses category tags in category URLs. Thank you for reporting, Andreas.

Version 0.8

  • Now compression level field’s label now links to the correct field id.
  • Now suppresses E_WARNING/E_STRICT notices in live mode caused by Textpattern’s timezone code when some conditions are met (TXP 4.2.0, PHP 5.1.0+, TXP’s Auto-DST feature disabled, TXP in Live mode). Error suppression will be removed when TXP version is released with fully working timezone settings.
  • Now generates UNIX timestamps within the SQL query, not with PHP.
  • Changed sliding panels’ links (a elements) into spans.

Version 0.7

  • Fixed: now deleting custom url leads back to the list view, not to the editing form.
  • Removed some leftover inline styles from v0.6.

Version 0.6

  • Rewritten the code that generates the sitemap.
  • New admin panel look.
  • Now custom permlink modes and custom urls are escaped. Users can input unescaped URLs/markup from now on.
  • Now custom URL list shows the full formatted URL after auto-fill instead of the user input.
  • Now custom URLs that start with www. are completed with http:// protocol.
  • Now all urls that do not start with either http, https, www, ftp or ftps protocol are auto-completed with the site’s address.
  • Custom url editor got own panel. No longer the form is above the URL list.
  • Added ability to manually turn gzib compression off and change the compression level.
  • Added setting to set zlib.output_compression off. See here, thank you for reporting superfly.
  • Preferences are now trimmed during save.
  • Merged rah_sitemap_update() with rah_sitemap_save().
  • From now on all new installations have default settings defined that will automatically exclude link, file and image categories from the sitemap. This won’t effect updaters.
  • Changed sitemap’s callback register from pre pretext to callback after it (callback is now textpattern). Now $pretext is set before the sitemap and thus more plugins might work within permlink settings and custom urls.
  • When using TXP’s clean URLs, requesting /sitemap.xml.gz and /sitemap.xml URLs will return the sitemap, not just the /?rah_sitemap=sitemap. This will of course require existing fully working clean urls.

Version 0.5

  • Added customizable timestamp formats.
  • Cleaned backend markup.
  • Combined individual preference queries.

Version 0.4

  • Added support for custom permlink rules: Now you can easily set any kind of permlink rules for articles, section and categories.
  • Added option to exclude future articles.
  • Added option to exclude past articles.
  • Added option to exclude expired articles.
  • Moved Custom URL UI to it’s own page.
  • Added multi-delete feature to Custom URL UI.
  • Improved Custom URL UI.
  • Removed default static appending domain from Custom URL input field.
  • Changed TXP minimum requirement to version 4.0.7 (and above). Note that the plugin still works with older TXP versions (down to 4.0.5) if the Exclude Expired articles -option is left empty (unset).

Version 0.3.2

  • Fixed view url that still (from version 0.2) included installation address before link.

Version 0.3

  • Added option to insert URLs that are outside Textpattern install directory.
  • Fixed option to exclude categories directly by type: added forgotten link type.

Version 0.2

  • Added option to exclude/include sticky articles.
  • Added option to exclude categories directly by type.
  • Fixed bug: now shows all categories, and not only article-type, in admin panel.
  • Fixed bug: removed double install query (didn’t do a thing, just checked table status twice).

Version 0.1.2

  • Fixed article listing bug caused by nasty little typo: now only 4 and 5 statuses are listed.

Version 0.1

  • First release.