apache > lenya
 

Mapping URLs to Documents

URL Axioms

Lenya 2.0 is based on the following axioms:

  • A URL is represented by exactly one document.
  • A document can be represented by an arbitrary number of URLs.
  • For each document, there is exactly one canonical URL.

This is reflected in the following methods:

  • DocumentBuilder.buildDocument(...)
  • DocumentBuilder.buildCanonicalUrl(...)

The concept of multiple URLs per document is typically used for language versions (foo_{defaultlanguage}.html = foo.html) and to support different URL suffixes (foo, foo.htm, foo.html, foo.pdf).

The site structure is tightly connected to the URL space. Link URLs are derived directly from the site structure. The bar node in the following example

<node id="foo">
  <node id="bar"/>
</node>

is accessed using an URL containing the snippet /foo/bar.

Language Versions

The different language versions of a document can either be accessed using suffixes (foo_en, foo_de), or by attaching them to different nodes with the same UUID attribute in the site structure. In the following example, the top-level nodes "en" and "de" are used as entry points for the respective language.

<site>
  <node id="en">
    <node id="welcome" uuid="def456...">
      <label xml:lang="en">Welcome</label>
    </node>
  </node>
  <node id="de">
    <node id="willkommen" uuid="def456...">
      <label xml:lang="de">Willkommen</label>
    </node>
  </node>
</site>

This results in the following URLs:

  • /en/welcome - "Welcome"
  • /de/willkommen - "Willkommen"