The webpal-core extension defines a set of default routes for rendering pages and serving resources. These are tested against the URL in order, and the first matching route is invoked. WebPal allows editing of routes with a convenient table view in order to manage larger numbers of routes easily.

Custom Routes

You can add custom routes by inserting a routes node in an extension like so:

Routes are matched against the URL in order specified, which means that to override existing routes, your custom extension should be placed before the webpal-core extension in order for the custom routes to be matched first.

Calling A Template

A pre-defined route can be used to call specific named templates. For example, assume you wrote a template as such:

<xsl:template name="my-custom-sitemap">
  <xsl:apply-templates select="/web/pages/page" mode="navigation"/>


you can now invoke it with this route:


Caution: this default route allows anyone to invoke your named templates. Thus, all named templates should ensure that they do not expose the entire XML or any protected pages to the browser. For example, the following named template copies the entire XML, including settings, and code nodes, to the browser.

<xsl:template name="not-a-good-template">
  <xsl:copy-of select="/web" />


Disabling Default Routes 

If you need to disable any of the default routes, simply override them with new behaviour in your custom extension. For example the following route will redirect the call-template URL to the home page: