Skip to content

Commit 59707f6

Browse files
committed
Include example of how to use html with view frameworks
1 parent fa7107c commit 59707f6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

blog/2025-06-23-html-template-literal.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,14 @@ app.get("/", (req, res) => {
189189
});
190190
```
191191

192+
### Using the html template literal with view frameworks
193+
194+
If you use view frameworks like React or Lit to render your markup on the server they typically already include some XSS hardening. To tell Podium you trust the generated HTML, use `DangerouslyIncludeUnescapedHTML`, available for both [layouts](https://podium-lib.io/docs/api/layout#dangerouslyincludeunescapedhtml) and [podlets](https://podium-lib.io/docs/api/podlet#dangerouslyincludeunescapedhtml).
195+
196+
```js
197+
app.get("/", (req, res) => {
198+
const trustedHtml = await render();
199+
const body = new DangerouslyIncludeUnescapedHTML({ __content: trustedHtml });
200+
res.podiumSend(html`${body}`);
201+
});
202+
```

0 commit comments

Comments
 (0)