HTML views
File templates under app/views/**/*.html — Blade-near, intentionally small.
API
| API | Meaning |
|---|---|
view(path, data) | Render file → HTML response (200) |
view(path, data, status) | Same with status |
render_view(path, data) | Render → string |
html(body) | HTML response from a string |
render_template(tpl, data) | Inline string template |
Paths are relative to app/views/ ("hello/show" → hello/show.html).
Requires running against a project directory (atlantus dev --path …).
Handler
get "/hello/{name}" {
def hello_name(req) {
let name = req.param("name")
return view("hello/show", { "name": name })
}
}
Template syntax
| Construct | Effect |
|---|---|
{{ key }} | HTML-escaped |
{{{ key }}} | Raw |
{{-- comment --}} | Stripped |
@if(x) / @else / @endif | Conditional |
@foreach(list as item) / @endforeach | Loop |
@extends("layouts/app") | Layout |
@section("content") … @endsection | Section |
@yield("content") | Layout hole |
@include("partials/nav") | Partial |
Layout example
app/views/layouts/app.html:
<!DOCTYPE html>
<html>
<body>
@include("partials/nav")
<main>@yield("content")</main>
</body>
</html>
app/views/hello/show.html:
@extends("layouts/app")
@section("content")
<h1>Hello, {{ name }}!</h1>
@endsection
Principles
- Escape by default
- Views are pure (no DB) — handlers pass data maps
- Prefer file views for real pages
Try it with atlantus dev after adding routes + templates.
Next: Built-in API.