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 EngineSyntax ExampleUsed ByLanguage
Liquid{\{ variable }\} / {\% raw %}{\% if %}{\% endraw %}Jekyll, ShopifyRuby
Go Templates{\{ .Variable }\} / {\% raw %}{\{ if . }\} {\% endraw %}HugoGo
Handlebars{\{variable}\} / {\{#if}\}Ember.js, Ghost, many JS toolsJavaScript
EJS<%= variable %> / <% if (...) { %>Express.js (Node)JavaScript
Mustache{\{variable}\}Many static generatorsLanguage-agnostic
Twig{\{ variable }\} / {\% raw %}{\% if %}{\% endraw %}Symfony (PHP), Grav CMSPHP
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)
#

FeatureJekyll (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 scopeIntuitive (like Ruby)Very strict (. = current context)
Error messagesFriendly-ishSometimes cryptic
ExtensibilityEasy with pluginsVery fast, limited customization
PerformanceSlower for big sitesBlazing 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 CaseRecommended Engine
Simple blog, Markdown-focusedJekyll (Liquid) or Hugo
Fast builds with complex structureHugo (Go Templates)
Tight integration with JS frameworksNunjucks, Handlebars
Backend web frameworksJinja2 (Flask), Twig (Symfony), EJS (Express)
Cross-language portabilityMustache

🔄 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

Exploring CSS Frameworks - A Collection of Lightweight, Responsive, and Themeable Alternatives
·1376 words·7 mins· loading
Web Development Frontend Development 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
·833 words·4 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
·599 words·3 mins· loading
Python Asyncio Concurrency Synchronous Programming Asynchronous Programming
Understanding async, await, and Concurrency # Understanding async, await, and Concurrency in Python …
High-Level View of HTML CSS JavaScript
·4022 words·19 mins· loading
Web Development HTML CSS JavaScript Web Development Frontend Development
High-Level View of HTML CSS JavaScript # Introduction # HTML, CSS, and JavaScript are the three …
Understanding Vocal Frequencies in Speech-to-Text AI Applications
·4605 words·22 mins· loading
AI NLP Speech-to-Text Vocal Frequencies Sound Signals AI Applications
Exploring Voice Signal Processing # Introduction # In AI projects that involve human voice, such as …