What Liquid is, and where it still works
Liquid is a small template language. It lets a page ask Teachable questions ("what's this course called?", "is this visitor signed in?") and show the answers, so your custom code can use your school's real data instead of text you've typed in.
What it looks like
Liquid sits inside ordinary HTML, marked out with curly braces:
<h2>Welcome to {{ current_school.name }}</h2>
{% if current_user %}
<p>Good to see you again.</p>
{% endif %}
-
{{ }}shows something: a name, a number, a link. -
{% %}decides something: whether to show a part, or how many times to repeat it.
When it runs
Liquid runs on Teachable's server, before the page is sent to the browser. By the time a visitor sees the page, the Liquid has gone, replaced by its answers. That's why it's fast and reliable, and also why JavaScript can't change it afterwards.
Where you can use it
| Place | Liquid works? |
|---|---|
| Custom HTML blocks on the home page, sales pages, thank-you pages and your own pages | Yes |
| Email templates | Yes |
| Custom certificates | Yes |
| The Power Editor | Yes, but it's the old way |
| Lessons | No |
| Code snippets | No |
This is the one that catches people out. Liquid doesn't run inside lessons, so anything in a lesson that depends on the student, such as their progress, has to be done with JavaScript instead. You'll see that pattern later in the course.
Liquid you've already seen
- The lesson and section totals on the course sales page are worked out by Liquid, live, every time the page loads.
- The navigation bar on the site's pages shows "Sign in" or your account menu, depending on whether you're signed in. That's one line of Liquid.
In short
- Liquid puts your school's real data into your own code: {{ }} shows, {% %} decides.
- It runs on Teachable's server before the page reaches the browser.
- It works in page code blocks, emails and certificates. Not in lessons or code snippets.