How to Create & Edit Templates

Templates in Jobman are created using a templating language called Liquid. It allows you to insert variables, control structures and loops to control how your templates appear when they are rendered.

In this article:

Template Variables

Objects

Tags

Control Flow

Iteration

FAQ: Templates and PDFs (External Article)

Template Variables

Depending on which template you choose for a given item (e.g. Email, Job Email, Lead Email, Quote, Invoice, etc), you will have access to a number of template variables which appear on the right side of the editing screen:

These template variables act as placeholders that automatically populate with data from elsewhere in your Jobman software. For example, the variable {{ contact.name }} will change to the name of a contact once you enter that contact's email address in the To field when sending an email, quote, etc.

NOTE: Not all templates have the same list of template variables available, because not all templates are able to link to the same areas in the software.

For example, the Email template does not have access to variables like {{ job.id }} or {{ job.number }}, because that data is located in Jobs, whereas the Email template can only access data from Contacts.

If you wanted to send an email containing job information, you would instead use the Job Email template, which contains all the template variables relating to jobs.

Objects

Objects contain the content that Liquid displays on a page. Objects and variables are displayed when enclosed in double curly braces: {{  and }} .

Input

{{ page.title }}		

Output

Introduction	

In this case, Liquid is rendering the content of the title  property of the page  object, which contains the text Introduction .

Tags

Tags create the logic and control flow for templates. The curly brace percentage delimiters {%  and %}  and the text that they surround do not produce any visible output when the template is rendered. This lets you assign variables and create conditions or loops without showing any of the Liquid logic on the page.

Input

{% ifuser %}
 Hello {{ user.name }}! 
{% endif %}	

Output

Hello Adam!		

Control Flow

Control flow tags create conditions that decide whether blocks of Liquid code get executed.

if

Executes a block of code only if a certain condition is true .

Input

{% if product.title == "Awesome Shoes" %}
 These shoes are awesome!
{% endif %}	

Output

These shoes are awesome!	

unless

The opposite of if  – executes a block of code only if a certain condition is not met.

Input

{% unless product.title == "Awesome Shoes" %}
 These shoes are not awesome.
{% endunless %}	

Output

These shoes are not awesome.

This would be the equivalent of doing the following:

{% if product.title != "Awesome Shoes" %}  
  These shoes are not awesome.
{% endif %}	

elsif / else

Adds more conditions within an if  or unless  block.

Input

<!-- If customer.name = "anonymous" -->
{% if customer.name=="kevin" %}
  Hey Kevin!
{% elsif customer.name=="anonymous" %}
  Hey Anonymous!
{%else%}
  Hi Stranger!
{%endif%}

Output

Hey Anonymous!	

Iteration

Iteration tags repeatedly run blocks of code.

for

Repeatedly executes a block of code. For a full list of attributes available within a for loop, refer to the forloop object.

Input

{% for productin collection.products %} 
 {{ product.title }}
{% endfor %}	

Output

hat shirt pants	

else

Specifies a fallback case for a for loop which will run if the loop has zero length.

Input

{% for product in collection.products %}
 {{ product.title }}
{% else %} 
 The collection is empty.
{% endfor %}	

Output

The collection is empty.	

For more information read the full documentation.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us