Template API

Within your templates, you’ll have access to a few things that let you access both the current page being rendered and other pages, as well as information about the site itself.

bundle

The current page being rendered.

Bundle.recent()

The updated, published, or created time. The first to exist is given.

Bundle.url()

Find the url the bundle will be rendered to.

meta

The configured metadata for the current bundle is available easily.

  • meta.title
  • meta.publish_time
  • meta.created_time
  • meta.updated_time
  • meta.status
  • meta.tags

This is all the data from the bundle’s YAML file.

engine

The Jules “Engine” usde to process and coordinate the website rendering is available for access to a lot of useful facilities.

JulesEngine.get_bundles_by(*args, **kwargs)

Find bundles in the engine filtered and ordered as needed.

order_key: The name of a meta field to order the results by order: ‘asc’ or ‘desc’ (default: ‘asc’) limit: The number of resuls to return (default: unlimited)

Any additional keyword arguments are taken as meta field values which bundles must match in order to be matched.

For example, to find all published bundles and give the most recent first:

engine.get_bundles_by(‘updated_time’, ‘desc’, status=’published’)
JulesEngine.get_bundle(*args, **kwargs)

With the same parameters as get_bundles_by() find exactly one bundle, and raise ValueError if 0 or more than 1 are found.

Head to the API documentation for everything available here.

config

The parsed site.yaml configuration is available from any template.

bundles

All of the bundles on the site are available through the bundles variable.

Project Versions

Table Of Contents

Previous topic

Jules API

Next topic

Roadmap

This Page