Forem Creators and Builders 🌱

Casey 💎 for Forem Community Success

Posted on

Understanding and Using Liquid Tags

Hey there, Forem Creators!

While you may be technical and understand what liquid tags are, it's very possible that your Forem will have members from all backgrounds and a simple "follow along" guide might help them.

Getting Started

You've likely noticed that when you click "Create Post" your Forem automatically provides a Markdown Guide and also a Liquid Tag guide, also located here {your-forem-url.tld}/new#liquid

Note: that the "Editor Basics" information only shows up if the cursor focus is on the body editor, if you don't see it just click where you would type in the content of the post.

img of the "new post" view

Let's Embed a Video

Embedding with YouTube might be one of the more common use cases for liquid tags. Let's find a video and share the link!

We'll be using a video from GitHub about Forem but instead of sending it as a link where you'd have to go to YouTube to watch it, you can display it inside your post!

If you looked through the Liquid tags list, you'd come across "Video Embed" section:
Video embed for youtube & vimeo

You'll notice that there are two arguments that you need to provide

{% provider identifier %}

provider - the service you want to use
identifier - the id of the video found on their platform

In our case, we'd look at the link on YouTube and copy the videos unique id:

Image of unique ID in the address bar

Our final use would look like this:

{% youtube YugO6TPC_tc %}


How cool is that!?

You've successfully created your first liquid tag and shared a video - awesome job!

Top comments (4)

Collapse
 
ildi profile image
Ildi • Edited

I love liquid tags 💚

Here is how you can embed Spotify content in your posts:

Enter the Spotify URI of the Spotify track / playlist / album / artist / podcast episode you are trying to embed.

Spotify track example:

https://open.spotify.com/track/2Nc1v8I86FUGorwjXKo0in

Its important to note that Spotify liquid tags require you to enter the provider twice.

{% spotify spotify:track:2Nc1v8I86FUGorwjXKo0in %}

Spotify podcast episode example:

https://open.spotify.com/episode/3XVJAUAoGQ3vrXQe6idaNo

{% spotify spotify:episode:3XVJAUAoGQ3vrXQe6idaNo %}

Collapse
 
michaeltharrington profile image
Michael Tharrington

The Spotify embed really is awesome. Also, great song choice with "Die For It" 🙌

Collapse
 
michaeltharrington profile image
Michael Tharrington • Edited

Awesome post!

My favorite video embed has gotta be {% youtube dQw4w9WgXcQ %} which translates to:

Collapse
 
ioscasey profile image
Casey 💎

Amazing!