/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-render-setrenderer-43f250ffec42-render-setrenderer-s0563-c0000.md
render() / setRenderer() (1) - hono-docs
render() / setRenderer() (1) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt render setrenderer S...
render() / setRenderer() (1)
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#render-setrenderer
Summary
You can set a layout using c.setRenderer() within a custom middleware. ```tsx twoslash / @jsx jsx */ / @jsxImportSource hono/jsx */ import { Hono } from 'hono' const app = new Hono() // ---cut--- app.use(async (c, next) => { c.setR...
Content
You can set a layout using c.setRenderer() within a custom middleware.
/** @jsx jsx */
/** @jsxImportSource hono/jsx */
import { Hono } from 'hono'
const app = new Hono()
// ---cut---
app.use(async (c, next) => {
c.setRenderer((content) => {
return c.html(
<html>
<body>
<p>{content}</p>
</body>
</html>
)
})
await next()
})Then, you can utilize c.render() to create responses within this layout.
import { Hono } from 'hono'
const app = new Hono()
// ---cut---
app.get('/', (c) => {
return c.render('Hello!')
})The output of which will be:
<html>
<body>
<p>Hello!</p>
</body>
</html>Additionally, this feature offers the flexibility to customize arguments. To ensure type safety, types can be defined as: