Skip to main content
The html operation renders HTML templates using template engines. It’s typically used in ensemble flows when an HTTP trigger needs to return server-rendered HTML. Note: The html operation is for rendering only. HTTP routing, authentication, CORS, and middleware are configured in the trigger: section using type: http.

HTTP Middleware

When using the html operation with HTTP triggers, you can add Hono middleware for cross-cutting concerns like logging, compression, and security headers:
Middleware executes before the HTML rendering, allowing you to add:
  • Request/response logging (logger)
  • Response compression for faster page loads (compress)
  • Security headers (secure-headers)
  • Cache validation with ETags (etag)
  • Custom authentication and rate limiting
See the HTTP Middleware Guide for complete documentation on using middleware with HTML responses.

Usage in Ensembles with HTTP Trigger

Configuration

Template Engines

Liquid (Default)

Handlebars

Simple (String Interpolation)

Complete Example

Personalization with Cookies

Use cookies to personalize HTML content based on user preferences or session data:
Set preference cookies when users change settings:

Next Steps

pdf

Generate PDFs

Triggers

HTTP trigger for web routing