# Templates Templates are HTML files stored in the `templates/` directory. Hunim wraps Markdown content inside the matching template before writing it to `public/`. ## Default template Create `templates/default.html` and it will be applied to every Markdown file that does not specify a custom template:
<!DOCTYPE html>
<html lang="{{ .Lang }}">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>{{ .Title }}</title>
  {{ .MetaTags }}
  <link rel="stylesheet" href="/style.css">
</head>
<body>
  {{ .Content }}
</body>
</html>
## Template variables
VariableDescription
{{ .Content }}The rendered HTML from the Markdown file.
{{ .Title }}The title field from frontmatter.
{{ .Date }}The formatted date (e.g. November 19, 2024). Only set for feed posts.
{{ .Author }}The author field from frontmatter. Only set for feed posts.
{{ with .PrevInSection }}...{{ end }}For feed posts, renders the block only when an older neighboring post exists. Inside the block, use {{ .RelPermalink }} and {{ .Title }}.
{{ with .NextInSection }}...{{ end }}For feed posts, renders the block only when a newer neighboring post exists. Inside the block, use {{ .RelPermalink }} and {{ .Title }}.
{{ .Lang }}The languageCode from hunim.toml.
{{ .MetaTags }}Generated <meta> tags for SEO (og:title, description, canonical URL).
## Custom templates A page can use a specific template by setting `template` in its frontmatter: ```markdown --- title: About template: wide.html --- ``` Hunim will look for `templates/wide.html` instead of `templates/default.html`. ## Feed templates Directories marked as feeds automatically look for a template named `{dirname}_list.html`. For a feed in `src/blog/`, create `templates/blog_list.html` to style individual blog posts. See [Feeds](/feeds) for details. ## Components in templates Templates can include [components](/components) using the component name syntax:
<body>
  {{ nav }}
  <main>
    {{ .Content }}
  </main>
  {{ footer }}
</body>
## Auto-reload When you run `hunim server`, a small polling script is injected automatically before the closing `` of every page, so the browser refreshes on file changes. You don't need to add anything to your templates, and production builds (`hunim build`) contain no such script.