Liquid on Teachable

This article goes over how to customize your school using Liquid.

CAUTION: 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.

Liquid Overview

NOTE: Product publishing and visibility updates may impact your custom code if you make use of Liquid customizations.

Specifically, the meaning of the course.is_published field return will refer to the new meaning of publishing. This is distinct from visibility and represents whether a course is available for enrollment by new students.

To supplement this, a course.is_listed field has been added to Teachable’s Liquid templates in order to represent the new product visibility setting. If you currently use the course.is_published field in order to represent whether a course should be visible to site visitors, you should update your code to reference both is_listed and is_published instead. This is because a course is visible to new users if it is published and visible.

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:

Available Liquid Objects and Fields on Teachable

Each dropdown menu below represents a unique liquid object. Within the dropdown, find the available liquid fields and descriptions for those fields.

At the bottom of this page, you can find a link to download a file of all available liquid objects and fields.

Attachment
Field Definition
content_type the content type for the attachment, such as 'audio_type'
url Link to download the file
host_id Id of video on wistia
kind the kind of attachment, example - 'video', 'text'
file_extension the file extension, example - 'pdf_embed', 'html'
name the name of the attachment file
host the host for the attachment, example - 'wistia'
position the position of the attachment in the lecture view
is_published whether or not the attachment is published
downloadable is this attachment embeddable
text the text content of the attachment if the attachment is of type 'text'
thumbnail_url the url to the thumbnail for the attachment's file if there is one
embeddable whether or not attachment is embeddable
id the id of the attachment in the database
AuthorBio
Field Definition
headline the author's headline
profile_image_url the author's profile image url
bio the author's bio description text
name the author's name
id the id of the author bio in the database
Category
Field Definition
name the category name
description the category description
is_published whether or not the category is published
id the ID of the category in our database
Comment
Field Definition
gravatar_url the gravatar URL of the comment's creator
user_id the ID of the comment's creator
body the text content of the comment
workflow_state the workflow_state of the comment, example - 'approved', 'removed', 'rejected', 'awaiting_review'
id the id of the comment in the database
Coupon
Field Definition
formatted_discount the discount amount with the currency formatting
formatted_price the price amount with currency formatting
calculated_discount the calculated discount amount
calculated_price the calculated price amount
currency the currency for the coupon
discount_percent the discount amount percentage
discount_amount the discount amount
number_available the number of available uses for the coupon
code the code for the coupon
name the coupon's name
expiration_date the coupon's expiration date
product_id the ID of the product that the coupon is applicable for
is_published whether or not the coupon is published
duration_kind the kind of duration for a coupon, example - 'forever', 'once'
number_of_uses the number of times a coupon has been used
id the ID for the coupon in the database
Block
Field Definition
liquid_path the path for the liquid partial used by the block
partial the name of the liquid partial used by the block
position the position of the block when rendered in a page
body the block's body content
data the data attributes for a block, example - body
id the id for the block in the database
CourseQuestion
Field Definition
question the question for the course_question
answer the answer for the question
course_id the id of the course that the course_question belongs to
position the position number of the course_question when rendered on a page
id the id for the course_question in the database
Course
Field Definition
url the full url for the course
path the relative path for the course
safe_image_url the url for the course's safe image
default_product_formatted_price the course's default product's formatted price
promo_video the promo video attachment object for this course
name the course's name
heading the course's heading text
page_title the course's page title in the meta tags
meta_description the course's description in the meta tags
friendly_url the course's friendly url
description the course's description
author_bio_id the course author's bio id
position the position of the course when rendered in the course directory
conversion_pixels the snippet for the course's thank you page
closing_letter the text content for the course's closing letter block on the sales page
image_url the url for the image for this course
hero_image_url the url for the course's hero image
is_published whether or not the course is available for purchase
is_listed whether or not the course is visible to students
bundled_courses_count the number of courses that are bundled with this course
is_open whether the course is open for enrollments or not
purchase_redirect_url optional url that can be set for redirecting to after purchasing instead of using thank you page
default_product the default product/pricing displayed for this course
id the id for this course in the database
course_questions the course_questions object for this course
has_products? whether or not a course has products/pricing available
user_enrolled? whether or not the current user is enrolled in this course
video the snippet for the course's promo video
lecture_sections the lecture sections for this course
percent_complete_for_user the percentage of the course that the current user has completed
Credential
Field Definition
id the id for the credential in the database
CustomLink
Field Definition
position the position of the custom link in the nav
location the location of the link, example - 'header', 'footer'
text the displayed text for the link
url the url for the link
id the id for the custom link in the database
Domain
Field Definition
url the url for the domain
id the id for the domain in the database
Integration
Field Definition
disqus_id the disqus id
id the id for the integration in the database
LectureProgress
Field Definition
id the id for the lecture progress in the database
LectureSection
Field Definition
name the name of the lecture section
course_id the id of the course that the lecture section belongs to
position the position of the lecture section when rendered in the curriculum
is_published whether or not a lecture section is published
lectures the published lecture objects that belong to this lecture section
id the id for the lecture section in the database
Lecture
Field Definition
url the url for the lecture
name the name of the lecture
download whether or not the lecture is downloadable
free_preview whether or not there is free previewing available for the lecture
description the lecture's description
course_id the id of the course that the lecture belongs to
position the position of the lecture when rendered in a lecture section/curriculum
is_published whether or not a lecture is published
lecture_section_id the id of the lecture section that the lecture belongs to
id the id for the lecture in the database
Product
Field Definition
formatted_price the product's price with currency formatting
name the name of the product
description the product's description
billing_interval the billing interval at which the product charges, example - 'monthly'
currency the currency for the price of the product
position the position of the product when rendered on a sales page
price the price amount for the product
cc_statement_description the text that appears on the cc statement for the purchase of this product
is_recurring whether or not a product charges on a recurring basis
is_published whether or not a product is published
price the price amount for the product
course_id the id of the course which the product belongs to
num_payments_required the number of payments required for the product if applicable
id the id for the product in the database
Sale
Field Definition
product_id the id of the product that the sale pertains to
user_id the user id of the purchaser
is_active whether or not a sale is active
current_period_start the sale's billing start period
current_period_end the sale's billing end period of the sale
is_recurring whether or not a sale is recurring
next_period_start when the next billing cycle begins
num_payments_required the number of required payments remaining to be made on a sale
id the id for the sale in the database
Page
Field Definition
title the page's title
friendly_url the page's friendly url
content the content for the page (NO LONGER IN USE, content is now kept in the blocks)
show_header whether or not the page should display the header
show_footer whether or not the page should display the footer
is_published whether or not the page is published
blank_page_template whether or not the page should use no template
published_at when the page was published
is_blog_post whether or not a page is a blog post
author_bio_id the id of the author bio that the page belongs to
is_disqus_enabled whether or not comments are enabled on the page
id the id for the page in the database
School
Field Definition
domain the domain for the school
primary_domain_url the url for the school's primary domain
purchasing_blocked? whether or not purchasing is blocked on a school
name the school's name
heading the school's heading text
description the school's description text
facebook_username the school's facebook username
twitter_username the school's twitter username
homepage_id the school's homepage id
google_plus_username the school's google+ username
logged_out_homepage_template the name of the school's template to render for logged out users
primary_domain_id the id of the school's primary domain
logged_in_homepage_template the name of the school's template to render for logged in users
course_id the id for the course that the school renders if it has a course sales page set as its homepage
email the email for the school
email_from_name the name from which the school emails
is_customized whether or not a school has customization
down_for_maintenance whether or not a school is down for maintenance
is_blog_enabled whether or not the school has enabled the blog feature
blog_title the school's blog title
blog_description the school's blog description
blog_about the school's blog about text
comments_threaded whether or not a school displays comments in a threaded structure
comments_moderation whether or not the school has comment moderation enabled
id the id for the page in the database
User
Field Definition
role the role of the user, example - 'owner', 'author'
gravatar_url the gravatar url for the user
email the user's email
affiliate_code the user's affiliate code
name the user's name
is_owner whether or not the user is an owner of the school
sign_in_count the number of sign ins for the user
is_author whether or not the user is an author for the school
last_four the last four numbers on the user's credit card if they have one saved
author_bio_id the user's author bio object id if they have one associated with them
preference the user's preferences
id the id for the user in the database

Download all the objects and fields below:

Was this article helpful?

49 out of 170 found this helpful