# include

> Render another template in place.

`include` renders another template in place. Pass it variables with `with`.

page.kiln:

```kiln
{% include "partials/header" with { title: page.title } %}
```

partials/header.kiln:

```kiln
<header>
	<a href="/">{{ site.name }}</a>
	<span>{{ title }}</span>
</header>
```

Output:

```html
<header>
	<a href="/">Example</a>
	<span>Pricing</span>
</header>
```

## Isolated by default

An included template only sees the variables you pass with `with`, plus globals. It can't see the caller's variables. This makes each template's inputs clear, and means it renders the same way wherever you use it.

Use the hash shorthand to pass variables that keep their names: `with { page, nav }`. Declare what the template expects with [`props`](https://kilnlang.com/docs/tags/props/).

## Dynamic names

The name can be any expression. This suits content made of sections, where each section type has its own template:

```kiln
{% for section in page.sections %}
	{% include "sections/" ~ section.type with { section } %}
{% endfor %}
```

## Missing templates

Add `ignore missing` to render nothing when the template doesn't exist:

```kiln
{% include "sections/" ~ section.type with { section } ignore missing %}
```
