Root attributes

robots (boolean): When set to true automatically creates the route /robots.txt using the static file with the same name.

sitemap (boolean): When set to true automatically creates the route /sitemaps.xml using the static file with the same name.

static_txt_content (list): Static content that will be served when present in the static folder.

pages (list): List of page objects that API2HTML will process and render

templates (key-value): List of template names and filename. The name is used in the page definition and the value is the relative path to the file.

layouts (key-value): List of layouts available names and filename. The layout loads the surrounding content so you only need to declare the inner content in each template. Layouts usually contain headers, footers and similar content.

extra(key-value): List of additional variables that will be available across all templates under {{ extra.key }}

public_folder (optional struct): If defined, the files and folders at path_to_folder will be served at the prefix url_prefix.

Page object

When declaring pages in the root the page object accepts the following attributes:

name: A friendly identifier for your page. Letters only, no spaces.
URLPattern: The URL where API2HTML will listen. You can use variables using colons ( :var)
BackendURLPattern: The API call that will be executed and injected inside the {{ Data }} variable. You can use the variables declared in URLPattern
Template: The template name as defined in the templates attribute
Layout: The layout that will encapsulate the template, as defined in the layouts attribute.
CacheTTL (string): Time for the Cache-Control header added to the responses. Use s for seconds, h hours, m for minutes. E.g: 4h

Declare pages in the right order

The order of appearance of the pages is very important, as if you have conflicting routes the behavior might not be the one you expect. When handling routes that share a part of the pattern, always declare the most specific case first and go down to the most generalist. E.g: