Shortcode Tutorial: Embedding Media
Learn how to use Zola shortcodes to embed LinkedIn posts, YouTube videos, and Shorts into your blog posts.
Zola shortcodes allow you to inject complex HTML into your Markdown files without cluttering your writing. This tutorial covers how to embed LinkedIn posts and YouTube content using the custom shortcodes built for this site.
1. LinkedIn Posts
To embed a LinkedIn post, use the linkedin shortcode with the post's unique ID.
Usage
{{ linkedin(id="7351069759850938368") }}Example
2. YouTube Videos
The standard youtube shortcode handles landscape (16:9) videos.
Usage
{{ youtube(id="wCEkK1YzqBo") }}Example
3. YouTube Shorts
For portrait (9:16) content like YouTube Shorts, we use the youtube-shorts shortcode which centers the video and maintains the correct aspect ratio.
Usage
{{ youtube_shorts(id="QZCHax14ImA") }}Example
4. Callouts
Use callouts to highlight important information, tips, or warnings. You can specify the type as info, tip, warning, or rust.
Usage
{% callout(type="tip") %}
This is a helpful tip!
{% end %}Examples
Information: This is a general information callout using the default blue accent.
Pro Tip: Use the specialized youtube-shorts shortcode for portrait videos to ensure they are centered and sized correctly!
Warning: Be careful when using direct HTML in Markdown; Zola shortcodes are a safer and cleaner alternative.
Rust Power: Since this site is "Rust-aligned", we have a special orange callout for all things related to the Rust programming language. 🦀