v1.0.1 · MIT · no dependencies
Safe, fast HTML templates for Go
Vascula is a template language for HTML. You write markup with {{ output }} and {% tags %}; an application compiles the template once and renders it with data.
go get vascula.dev/vascula@latest<h1>{{ settings.title }}</h1>
{% if settings.items.size > 0 %}
<ul>{% for item in settings.items %}<li>{{ item | upcase }}</li>{% endfor %}</ul>
{% else %}
<p>Nothing yet.</p>
{% endif %}{"settings": {"title": "Tea & coffee", "items": ["sencha", "<b>espresso</b>"]}}<h1>Tea & coffee</h1>
<ul><li>SENCHA</li><li><B>ESPRESSO</B></li></ul>
The output is escaped for HTML automatically, so the & and the markup inside the data cannot break the page.

What makes it different
Safe by default
Everything you print is HTML-escaped. There is no raw filter and no way for a template to switch escaping off; only the application can hand over trusted HTML. JSON printed inside an HTML attribute is escaped for that position too, and a link or other URL with printed parts cannot be a javascript: URL.
Explicit about data
A template can only read the data roots the application allows. Reading anything else is an error, not a silent blank, and the application can list every name a template reads before it ever renders.
Bounded
Compilation and rendering have limits on source size, nesting, work, output and value size. A template cannot loop forever or build a gigabyte string.
Fast
A 48-product grid renders in about 120 microseconds, more than twice as fast as the popular Liquid implementations in Go and Ruby. See Performance.
Familiar
The syntax will look familiar if you know Liquid or Jinja, but Vascula is its own language with documented behavior. See Coming from Liquid.
Benchmarks
Microseconds per render, lower is better. How it was measured
Product grid, 48 products
where | sort | map | join over 48 products
The same, products with 150 fields each
Compiling the grid template
Where to start
Write templates
Syntax, then the tutorial
Look up a filter or tag
Embed Vascula in a Go program
Getting started, then the Go API
Extend it with your own filters and tags
Understand what it protects against
Generate templates with an AI agent
Build a theme for a Tringify store
Made by Tringify
Vascula is made by Tringify and renders every Tringify storefront. Building a theme for a Tringify store? See the Tringify theme docs.
Versions
Vascula is at version 1 and follows semantic versioning; the changelog lists every change. See Versions and stability.
Every page of this site is also available as Markdown: add .md to the address, or read llms-full.txt for the whole site in one file.