Servant

Pages

Each text document under pages/ will be shown as a page on your site. Just creating a new .txt file will result in a new page, but you can also write files in Markdown, HTML, PHP, or any of the other supported formats.

All files are converted and served to your users as HTML automatically. For example, your site's folder could look like this:

mysite/
pages/
    about.txt
    documentation.textile
    examples.php
    features.html
    get-started.md
assets/

Pages can be nested in directories, and Servant will use those to generate categories in the sitemap. Your pages are automatically available to your users, with fancy URLs. A path will be generated for each page, e.g. http://servant.com/read/<category>/<page>. Pages will also be visible in any menus generated by templates.

Friendly URLs

Normally, if a user points her browser to a non-existing page, Servant will try to avoid an error page and instead show a parent page if possible.

For example, if the user goes to docs/components/settings/ but this page is not available, Servant will show the docs/components/ page if it exists. This works automatically and results in fewer broken links for end users.

Links & images

Pointing to other documents with links, or adding images to a page is really easy. Defining links and images can be done in different ways depending on the file format, but the URLs always work in the same way.

Here are some examples in Markdown.

Relative URLs

pages/welcome.md
[Get in touch](contact-us)
[See where we are](contact-us/map)

Root-relative URLs

pages/contact-us/map.md
[Back to home page](/)
[Welcome page on the root level](/welcome)
[See where we are](/contact-us/map)

Variables available for scripting

For dynamic templating languages (php and derivatives), the following variables are available:

Variable Description Read more
$servant Main services provided by Servant. ServantMain
$parameters Additional parameters provided in URL.
$page The current page. ServantPage