Skip to content

Templates

Calvin edited this page Sep 20, 2017 · 2 revisions

There's three different directories that you'll have to worry about when designing:

  • res, where static content like CSS lives.
  • pages, where Markdown-formatted pages and a JSON file holding human-friendly names for them live.
  • views, where EmbeddedJS template files that render data provided by the application server live.

There are very simple example files included, but you can create your own from the examples they provide. You can edit the config file to point to the directory that contains them; this way, you can isolate them from the adventure repository to avoid having to manage them inside of the repository as it changes.

Purpose

You want to create pages for static, unchanging content, such as to describe policy. The titles.json files is a key-value mapping of file to human readable title.

Pages are routed by the route /:page - there are no subdirectories, and they won't override built-in routes like /library.

Res

You want to fit unchanging content that aren't pages rendered by Markdown here - often things like client-side JavaScript or CSS files, as well as images.

Views

Views are EmbeddedJS templates; HTML files containing special tags that run JavaScript on the server side, that render out content provided by the application server. Generally, these are JavaScript object conversions of the contents provided by the tables; so you can consult the tables and adventure route sources as needed.

The head and foot templates are recommended to be used to wrap around your content. You can pass parameters to them; head has the title passed to it.

If you're in doubt for what to do, consult the EJS documentation or the basic prototype templates included in adventure. If you need changes to be made by the adventure code to include something or alter it, file an issue.

Clone this wiki locally