Writing custom templates
To make the things falcon generate blend in with your own website, you can create your own templates. Templates should be placed in ~/.falcon/templates or in .falcon/templates in your repository root. You have to create 3 different templates: for the main index, the pocket index and the component index.
To create the skeleton for a template called mysite, do the following:
mkdir ~/.falcon/templates/mysite/ touch ~/.falcon/templates/mysite/base.html touch ~/.falcon/templates/mysite/pocket.html touch ~/.falcon/templates/mysite/component.htmlAny files the template needs (images, stylesheets) should also be placed in ~/.falcon/templates/mysite/ so falcon can synchronise them to your mirrors.
Template syntax
Templates should be written in the syntax used by django's templates. Documentation about this syntax can be found on the django website.Available variables
The following variables are available to the templates:- conf (base, pocket, component)
-
The falcon configuration object. Available useful attributes:
- origin
- The configured origin
- description
- A short description of the repository, usable as title
- create_filelist
- Wheteher apt-file is supported
- gpgkey
- The GPG key used for signing
- long_description
- A longer textfield, useful for introductory text
- webbase
- The webbase of the main repository
- architectures
- A list fo the supported architectures
- dots (pocket, component)
- A number of concatenated '../' strings that will make relative links point to the root of the repository.
- pockets (base)
- A list of all pockets, alphabetically ordered by name.
- mirrors (base)
- A list of all mirrors, alphabetically ordered by name.
- mirror (base)
- Only set when generating the main index for a mirror. The current mirror.
Available filters and tags
Django's template system can be extended with custom filters and tags. The following filters and tags are implemented by falcon.- shortdesc (filter)
-
Usage: {{ pkg.description | shortdesc }}
Gives the short description from a control file. - longdesc (filter)
-
Usage: {{ pkg.description | longdesc }}
Gives the long description from a control file. - format_changelog (filter)
-
Usage: {{ pkg.changelog | format_changelog }}
Formats a changelog nicely. - api (tag)
- Usage: {% api 1.0 %} Specifies which API version this template is written for. Each of the three template files in a template must use this tag at least once.