# Introduction

> What Kiln is, and what it is good at.

Kiln is a template language for building websites on the server. You write HTML with a small set of tags and expressions, and Kiln turns it into a page.

page.kiln:

```kiln
<h1>{{ site.name|upper }}</h1>
<ul>
	{% for post in posts %}
		<li><a href="{{ post.url }}">{{ post.title }}</a></li>
	{% endfor %}
</ul>
```

Output:

```html
<h1>ACME</h1>
<ul>
	<li><a href="/blog/hello/">Hello, world</a></li>
	<li><a href="/blog/year-one/">Our first year</a></li>
</ul>
```

If you have used Twig, Jinja or Liquid, this will look familiar. Kiln keeps the syntax people and AI models already know, and changes the parts that tend to cause bugs.

## What Kiln is good at

- **Server-rendered sites.** Layouts, components with typed props, includes and macros cover what a website needs.
- **Loading data from templates.** Templates can call async functions, such as `document("page")`. Kiln only waits when a call returns a promise.
- **Running anywhere.** The core has no dependencies and never uses `eval`, so it runs on Node and Cloudflare Workers.
- **Templates you didn't write.** Templates can only read data you pass them. Output is escaped by default, and limits stop templates that run too long.
- **Clear errors.** Strict mode catches typos, and every error shows the template, line and column.

## How it works

You create an environment once, with a loader that finds your templates and any functions or filters you want to add. Then you render templates by name.

server.ts:

```ts
import { createKiln } from "@lucidkiln/core";
import { fileLoader } from "@lucidkiln/core/node";

const kiln = createKiln({
	loader: fileLoader({ root: "templates" }),
});

const html = await kiln.render("pages/home", { title: "Welcome" });
```

Kiln compiles each template once and keeps it in memory, so later renders are fast.

## Where to go next

- [Install Kiln](https://kilnlang.com/docs/installation/) in a Node or Workers project.
- Follow the [quick start](https://kilnlang.com/docs/quick-start/) to render a page with a layout.
- Read [Coming from Twig](https://kilnlang.com/docs/coming-from-twig/) if you know Twig already.
