Skip to content

Templates

The subfork.yml template file is a config file that contains information about your site template files, routes and task workers, for example:

Required

  • domain the domain or hostname of the site (no http)
  • templates named list of site template files and routes

Optional

  • template_folder template folder path (default "templates")
  • static_folder static file folder path (default "static")
  • auto_minimize minimize file contents if possible

For example, a basic subfork.yml template file might look like this:

# enter verified site domain here
domain: example.fork.io

# enter site credentials here
# access_key: ${SUBFORK_ACCESS_KEY}
# secret_key: ${SUBFORK_SECRET_KEY}

# template and static file folder paths
# template_folder: templates
# static_folder: static

# page template definitions
templates:
  index:
    route: /
    file: index.html
  user:
    route: /user/<username>
    file: user.html

# task worker definitions
workers:
  test:
    queue: test
    function: subfork.worker.test

Multiple routes to a given template are supported, for example:

templates:
  foo1:
    route: /foo
    file: foo.html
  foo2:
    route: /foo/<bar>
    file: foo.html

In the above example, the foo.html template file will be rendered for both the /foo and /foo/<bar> endpoints, and the value of <bar>in the URL will be available inside foo.html using {{bar}}.