Templates

Note

Templates are currently disabled during open beta. Please contact us over at support@jumpship.net if you need access to this feature.

Templates are an advanced customisation feature allowing you to change the way your pages are generated.



How templates work

Jump Ship templates make use of the Jinja templating language.

This means that your templates can support if statements, for loops, variables, and more.


A Page Object variable is passed into every template section as page.

A template is used for a page if it matches its filter.

Templates include four fields:


In summary, templates are rendered verbatim as they appear in your template, with the following exceptions:

  • {{ statement }} lines perform some code (renders the result).
  • {% expression %} lines perform some code (doesn't render the result).
  • {# comment #} lines are for adding comments in your template (doesn't render the result).

Template indentation

Tabs included before expressions and statements will be included in your template by default, so it's good practice to avoid indenting your template code here.

{% if x == 5 %}
    prop: Hello World!
{% endif %}

This will render with the indent included before "prop".

{% if x == 5 %}
prop: Hello World!
{% endif %}

This will render without indentation.

New-lines at the end of starter templates

By default, a single new-line is given at the end of our starter templates.

This is intentional, and helps with version control systems such as Git which are dependent on this new-line to be able to correctly identify changes to the end of the file.

This can of course be removed, though we don't recommend it.


Filter

The filter box is used to filter this template to certain pages only.

This is done using a single line expression that returns a boolean value that's either:

  • True (matches); or
  • False (doesn't match).

An empty filter box will apply this template to all pages.

Filter Examples

Filtering your template to only apply to pages inside the 'Projects' database:

page.database.title == 'Projects'

Filtering your template to only apply to databases:

page.type == 'database'

More ways to filter can be seen on the Page Object page.

How filters are prioritised

A page will take the first template that matches its filter and then apply that template to the page.

Page templates are discovered in the order they are created in.

So for example, you might want more specific templates at the bottom, and then your broad all-encompassing template placed on top, like so:

  • Some generic template.
  • More specific template.

Re-ordering your templates

To re-order your templates, for now, you must recreate the templates in the order you want them in.

This can be achieved through copying and pasting your templates into a separate text editor and then recreating your templates again one at a time.

This will be improved in the future.


Title

The title box is used to change how the page title is rendered.

This is the title of the markdown file (>Page Name<.md).

By default, the title box uses the page's file-safe title.

Title Examples

Exporting using the page's file-safe title (default):

{{ page.title_file_safe }}

Exporting using a creation time ID prefix (for use in Zettelkasten type set-ups):

{{ page.created_time_arrow.format('YYYYMMDDHHmm') }} {{ page.title_file_safe }}

The link box is used to change how the link for this page is rendered.

This is the default link template:

{% if page.title_unique != page.link_display_text %}
[[{{ page.title_unique }}|{{ page.link_display_text }}]]
{% else %}
[[{{ page.title_unique }}]]
{% endif %}
  • If the display text is not equal to the page title, the display text is shown.
  • If the display text is equal to the page title, the display text is not shown.

This renders links like so:

[[Page Name]]

As the page title has to undergo some filtering due to file name limitations, often you will lose information.

For example, a note called "Page Name #1" will show as:

[[Page Name 1]]

To resolve this, we add unfiltered link display text in these instances, like so:

[[Page Name 1|Page Name #1]]

It will also preserve the note name in the case of duplicates:

[[Other Page]]
[[Other Page (2)|Other Page]]

Content

The content box is used to change the way your page contents are rendered.

This is the information inside the markdown file.