This article goes over how to customize your school using Liquid.
CAUTION: Liquid is a more advanced feature, and our documentation on it is still in development. Please use it on your Teachable school with caution, as our Customer Care team is unable to assist with issues related to custom code.
Liquid Overview
Liquid is an open-source template language developed by Shopify, which serves as a link between stored data and the HTML templates that are displayed on the page of your web browser.
Liquid uses two forms of markup, which is simply defined as a sequence of characters that are used to interpret and structure information. These two forms are known as Object and Tag.
Denoted by the use of curly braces, the Object markup determines results. By acting as placeholders for data, the Object markup will determine what data is displayed on your school.
{{Print Object}}
Represented by the use of curly braces and percentage signs, the Tag markup determines template logic. Tags allow you to control how and when data is displayed on your school.
{% Tag %}
When using Liquid, you can also use the pipe symbols, represented by a straight | line, to act as a filter. Filters are simple methods that modify the output of numbers, strings, variables, and objects.
To see this in action, let's take an example from the blog partial template that can be found within the Power Editor.
{{ post.published_at | date: "%d %B, %Y" }}
Here, the blog 'post' will serve as the object or attribute that will be output and, with the inclusion of a pipe symbol, it will be filtered and displayed by date. For reference:
- %d = The day of the month
- %B = The full month
- %Y = The Year with century
Using Liquid on Teachable
You can use Liquid in the following areas of your school:
- Power Editor
- Email Templates
- Liquid blocks (available on homepages, sales pages, thank you pages, and custom pages)
NOTE: Adding custom code to your school is an advanced modification—we can't guarantee full functionality or compatibility with current or future versions of Teachable. This includes how the code functions, as well as how it impacts the appearance of your school.
Available Liquid Objects and Fields on Teachable
Here's a full list of all the objects and fields available:
Object
Field
Attachments are videos, pdfs, audio files, quizzes, and text attachments to lectures
the content type for the attachment, such as 'audio_type'
Link to download the file
Id of video on wistia
the kind of attachment, example - 'video', 'text'
the file extension, example - 'pdf_embed', 'html'
the name of the attachment file
the host for the attachment, example - 'wistia'
the position of the attachment in the lecture view
whether or not the attachment is published
is this attachment embeddable
the text content of the attachment if the attachment is of type 'text'
the url to the thumbnail for the attachment's file if there is one
whether or not attachment is embeddable
the id of the attachment in the database
the gravatar_url for the comment's creator
the id of the comment's creator
the text content of the comment
the workflow_state of the comment, example - 'approved', 'removed', 'rejected', 'awaiting_review'
the id of the comment in the database
Download all the objects and fields below: