Skip to main content
  1. Data Science Blog/

A Developer's Guide to Templating Engines

·448 words·3 mins· loading · ·
Web Development Templating Engines Jekyll Liquid Hugo Go Templates Web Development

On This Page

Table of Contents
Share with :

A Developer’s Guide to Templating Engines
#

What is a Templating Engine?
#

A templating engine is a system used to generate dynamic HTML pages by combining a template with data. It’s used in static site generators (SSGs), web frameworks, and CMSs.

Templating engines can be confusing, especially when switching between site generators like Jekyll (Liquid) and Hugo (Go templates).

🔍 Common Templating Engines (and who uses them)
#

Templating Engine Syntax Example Used By Language
Liquid {\{ variable }\} / {\% raw %}{\% if %}{\% endraw %} Jekyll, Shopify Ruby
Go Templates {\{ .Variable }\} / {\% raw %}{\{ if . }\} {\% endraw %} Hugo Go
Handlebars {\{variable}\} / {\{#if}\} Ember.js, Ghost, many JS tools JavaScript
EJS <%= variable %> / <% if (...) { %> Express.js (Node) JavaScript
Mustache {\{variable}\} Many static generators Language-agnostic
Twig {\{ variable }\} / {\% raw %}{\% if %}{\% endraw %} Symfony (PHP), Grav CMS PHP
Jinja2 {\{ variable }\} / {\% raw %}{\% if %} {\% endraw %} Flask (Python) Python
Nunjucks {\{ variable }\} / {\% raw %}{\% if %} {\% endraw %} Eleventy (JS SSG) JavaScript

💡 Key Differences Between Hugo (Go Templates) and Jekyll (Liquid)
#

Feature Jekyll (Liquid) Hugo (Go Templates)
Tag syntax {\{ variable }\} / {\% ... %} {\{ .Variable }\} / {\{ if ... }\}
Loops {\% for item in list %} {\{ range .List }\}
Conditions {\% if condition %} {\{ if .Condition }\}
Partial templates {\% include 'file.html' %} {\{ partial "file.html" . }\}
Data scope Intuitive (like Ruby) Very strict (. = current context)
Error messages Friendly-ish Sometimes cryptic
Extensibility Easy with plugins Very fast, limited customization
Performance Slower for big sites Blazing fast

🧠 Why It Feels Confusing
#

  • {\{ ... }\} is common across many engines but means different things.
  • In Liquid, {\{ }\} is for output; {\% \%} is for logic.
  • In Hugo, everything is in {\{ }\} and the dot (.) matters a lot (.Title, .Params, etc.).
  • Hugo doesn’t use {\% raw \%-} — that’s Liquid-only. (remove -)
  • Each engine has its quirks and idioms — no true standard.

🧰 When to Use What?
#

Use Case Recommended Engine
Simple blog, Markdown-focused Jekyll (Liquid) or Hugo
Fast builds with complex structure Hugo (Go Templates)
Tight integration with JS frameworks Nunjucks, Handlebars
Backend web frameworks Jinja2 (Flask), Twig (Symfony), EJS (Express)
Cross-language portability Mustache

🔄 Migrating Tips
#

When moving between engines (e.g., Jekyll → Hugo):

  • Strip all {\% raw %}, {\% endraw %}
  • Replace {\% include %} with {\{ partial }\}
  • Replace {\% for post in site.posts %} with {\{ range .Site.RegularPages }\} or similar
  • Be very careful with ., .Params, and context in Hugo
Dr. Hari Thapliyaal's avatar

Dr. Hari Thapliyaal

Dr. Hari Thapliyal is a seasoned professional and prolific blogger with a multifaceted background that spans the realms of Data Science, Project Management, and Advait-Vedanta Philosophy. Holding a Doctorate in AI/NLP from SSBM (Geneva, Switzerland), Hari has earned Master's degrees in Computers, Business Management, Data Science, and Economics, reflecting his dedication to continuous learning and a diverse skill set. With over three decades of experience in management and leadership, Hari has proven expertise in training, consulting, and coaching within the technology sector. His extensive 16+ years in all phases of software product development are complemented by a decade-long focus on course design, training, coaching, and consulting in Project Management. In the dynamic field of Data Science, Hari stands out with more than three years of hands-on experience in software development, training course development, training, and mentoring professionals. His areas of specialization include Data Science, AI, Computer Vision, NLP, complex machine learning algorithms, statistical modeling, pattern identification, and extraction of valuable insights. Hari's professional journey showcases his diverse experience in planning and executing multiple types of projects. He excels in driving stakeholders to identify and resolve business problems, consistently delivering excellent results. Beyond the professional sphere, Hari finds solace in long meditation, often seeking secluded places or immersing himself in the embrace of nature.

Comments:

Share with :

Related

Roadmap to Reality
·916 words·5 mins· loading
Philosophy & Cognitive Science Interdisciplinary Topics Scientific Journey Self-Discovery Personal Growth Cosmic Perspective Human Evolution Technology Biology Neuroscience
Roadmap to Reality # A Scientific Journey to Know the Universe — and the Self # 🌱 Introduction: The …
From Being Hacked to Being Reborn: How I Rebuilt My LinkedIn Identity in 48 Hours
·893 words·5 mins· loading
Personal Branding Cybersecurity Technology Trends & Future Personal Branding LinkedIn Profile Professional Identity Cybersecurity Online Presence Digital Identity Online Branding
💔 From Being Hacked to Being Reborn: How I Rebuilt My LinkedIn Identity in 48 Hours # “In …
Exploring CSS Frameworks - A Collection of Lightweight, Responsive, and Themeable Alternatives
·1378 words·7 mins· loading
Web Development Frontend Development Design Systems CSS Frameworks Lightweight CSS Responsive CSS Themeable CSS CSS Utilities Utility-First CSS
Exploring CSS Frameworks # There are many CSS frameworks and approaches you can use besides …
Dimensions of Software Architecture: Balancing Concerns
·871 words·5 mins· loading
Software Architecture Software Architecture Technical Debt Maintainability Scalability Performance
Dimensions of Software Architecture # Call these “Architectural Concern Categories” or …
Understanding `async`, `await`, and Concurrency in Python
·637 words·3 mins· loading
Python Asyncio Concurrency Synchronous Programming Asynchronous Programming
Understanding async, await, and Concurrency # Understanding async, await, and Concurrency in Python …