Liquid Tags Examples
This document demonstrates various Liquid tag patterns and their usage in Jekyll. Each example shows both the rendered output and the Liquid syntax used to create it, making it an excellent learning resource for understanding how Liquid templating works.
Table of Contents
- Table of Contents
- Basic Liquid Variables
- Control Flow Tags
- Loop Tags
- Variable Assignment and Manipulation
- String Filters
- Array Filters
- Date Filters
- Math Filters
- URL Filters
- Advanced Liquid Examples
- Include Tags (if templates exist)
- Raw Tags for Code Examples
- Capture Tags for Complex Content
- Comment Tags
- Validation and Error Handling
- Performance Considerations
- Best Practices Demonstrated
Basic Liquid Variables
Site Variables
Rendered Output:
- Site Title: My Info Just Under Glass
- Site Description: MIJUG.NET serves the communities of Southeast Michigan, Ohio, and Florida with technology, sustainability, and community engagement resources. A platform by Kranson Enterprises for sharing knowledge and connecting communities.
- Site URL: https://www.mijug.net
- Build Time: October 09, 2025 at 03:02 PM
Liquid Syntax:
Page Variables
Rendered Output:
- Page Title: Liquid Tags Examples
- Page Date: October 09, 2025
- Page URL: /docs/liquid-tags-examples/
- Page Layout: page
Liquid Syntax:
Control Flow Tags
Conditional Logic
Rendered Output:
β Success: This page has a title: βLiquid Tags Examplesβ
π Published: This content is published (not a draft)
Liquid Syntax:
Case Statements
Rendered Output:
π This is a regular page
Liquid Syntax:
Loop Tags
Site Posts Loop
Rendered Output:
Recent Posts:
-
Building a Modern TypeScript + Jekyll Workspace in 2025 - October 06, 2025
-
The Great JavaScript Divide - October 03, 2025
-
September 2025: A Look Back at the Sessions - October 01, 2025
Liquid Syntax:
Documentation Pages Loop
Rendered Output:
Documentation Pages:
Liquid Syntax:
Site Data Loop (Categories)
Rendered Output:
Available Categories:
-
Tutorial (tutorial): Step-by-step learning guides
-
Getting Started (getting-started): Initial setup and configuration guides
-
Development (development): Software development topics
-
TypeScript (typescript): TypeScript specific content
-
Jekyll (jekyll): Jekyll static site generator content
-
Testing (testing): Testing strategies and frameworks
-
Deployment (deployment): Deployment and DevOps topics
-
Configuration (configuration): Setup and configuration guides
-
Best Practices (best-practices): Recommended approaches and patterns
-
HTML (html): HTML markup and web standards
-
Web Development (web-development): General web development topics
-
Announcements (announcements): Site announcements and updates
-
Linux (linux): Linux operating system topics
-
Documentation (documentation): Documentation and guides
-
Navigation (navigation): Site navigation and structure
Liquid Syntax:
Site Data Loop (Tags)
Rendered Output:
Popular Tags:
-
TypeScript: Microsoftβs typed superset of JavaScript
-
Jekyll: Transform your plain text into static websites and blogs
-
Development: Software development tools and practices
-
VS Code: Visual Studio Code editor and extensions
-
WSL: Windows Subsystem for Linux
Liquid Syntax:
Variable Assignment and Manipulation
Rendered Output:
Calculated Values:
- Current Year: 2025
- Site Age: 0 years
- Estimated Reading Time: 14 minute(s)
- Word Count: 2676 words
Liquid Syntax:
String Filters
Rendered Output:
Text Transformations:
- Original: Jekyll and Liquid are powerful tools for static site generation
- Capitalize: Jekyll and liquid are powerful tools for static site generation
- Upcase: JEKYLL AND LIQUID ARE POWERFUL TOOLS FOR STATIC SITE GENERATION
- Downcase: jekyll and liquid are powerful tools for static site generation
- Truncate: Jekyll and Liquidβ¦
- Truncate Words: Jekyll and Liquid are powerfulβ¦
- Replace: Hugo and Liquid are powerful tools for static site generation
Liquid Syntax:
Array Filters
Rendered Output:
Array Operations:
- Technologies Array: TypeScript β’ Jekyll β’ Ruby β’ Node.js β’ VS Code
- First Item: TypeScript
- Last Item: VS Code
- Array Size: 5
- Sorted: Jekyll, Node.js, Ruby, TypeScript, VS Code
- Reversed: VS Code β Node.js β Ruby β Jekyll β TypeScript
Liquid Syntax:
Date Filters
Rendered Output:
Date Formatting:
- Full Date: Thursday, October 09, 2025
- Short Date: 10/09/2025
- Time: 03:02 PM
- ISO 8601: 2025-10-09T15:02:00-04:00
- RFC 822: Thu, 09 Oct 2025 15:02:00 -0400
Liquid Syntax:
Math Filters
Rendered Output:
Mathematical Operations:
- Base Number: 42
- Plus 10: 52
- Minus 5: 37
- Times 2: 84
- Divided by 3: 14
- Modulo 7: 0
Liquid Syntax:
URL Filters
Rendered Output:
URL Manipulations:
- Relative URL: /docs/example
- Absolute URL: https://www.mijug.net/docs/example
- URL Encode: hello+world+%26+special+chars%21
- CGI Escape: hello+world+%26+special+chars%21
Liquid Syntax:
Advanced Liquid Examples
Dynamic Content Based on Page Properties
Rendered Output:
This page is tagged with:
Liquid Syntax:
Conditional Content Loading
Rendered Output:
π Table of Contents: This page includes an auto-generated table of contents.
π Parent Page: This page is part of the βGetting Startedβ section.
Liquid Syntax:
Complex Data Processing
Rendered Output:
Content Statistics:
- Blog Posts: 19
- Documentation Pages: 20
-
Total Content Pages: 39
- Average Content per Type: 19 pages
Liquid Syntax:
Include Tags (if templates exist)
Attempting to Include Common Components:
Raw Tags for Code Examples
Displaying Liquid Syntax:
Capture Tags for Complex Content
Rendered Output:
Captured Content:
This is a complex content block that includes:
- Multiple lines
- Markdown formatting
- Variables: My Info Just Under Glass
- Current date: 2025-10-09
Liquid Syntax:
Comment Tags
Validation and Error Handling
Rendered Output:
Safe Variable Access:
- Page Author: Bob Kranson
- Page Excerpt: This document demonstrates various Liquid tag patterns and their usage in Jekyll. Each example shβ¦
- Page Categories: development
Null Checks:
β Null check working properly - undefined variables are handled gracefully.
Liquid Syntax:
Performance Considerations
Rendered Output:
- Posts with βpostβ layout: 19
- Reusing the same calculation: 19
Liquid Syntax:
Best Practices Demonstrated
- Use unless for negative conditions
- Prefer assign over direct computation in loops
- Use default filter for undefined variables
- Use raw tags when displaying Liquid syntax
- Use capture for complex multi-line content
- Always check for existence before using site.data
π‘ Pro Tip: This page demonstrates that Liquid tags are properly configured and working in your Jekyll setup. Each section shows both the rendered output and the exact Liquid syntax used, making it easy to learn and copy patterns for your own content.
Last updated: September 25, 2025