# \#leaf

**URL:** https://forums.swift.org/tag/leaf/771.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [LeafKit 1.14.2: Properly HTML-escape collection values](https://forums.swift.org/t/leafkit-1-14-2-properly-html-escape-collection-values/85340)

<div class="topic-metadata">

**Author:** [@gwynne](https://forums.swift.org/u/gwynne)\
**Replies:** 0\
**Last updated:** [March 14, 2026, 1:08am UTC](https://forums.swift.org/t/leafkit-1-14-2-properly-html-escape-collection-values/85340 "2026-03-14T01:08:57Z")

</div>

LeafKit 1.14.2 has just been released to address a vulnerability where values of array or dictionary type would not be HTML-escaped when used in Leaf variable substitution tags, allowing XSS injection if the content of t…

---

## [Leaf template extension issues](https://forums.swift.org/t/leaf-template-extension-issues/70923)

<div class="topic-metadata">

**Author:** [@Nebue](https://forums.swift.org/u/Nebue)\
**Replies:** 8\
**Last updated:** [July 25, 2025, 6:16pm UTC](https://forums.swift.org/t/leaf-template-extension-issues/70923 "2025-07-25T18:16:45Z")

</div>

Hi there! I am just starting my first project with vapor and leaf. All sound nice but I am running into some early issues when rendering embedded templates. It just does not load the content of my child templates, tell…

---

## [SwiftWebUI - is there an opportunity for Leaf to support SwiftUI for the Web](https://forums.swift.org/t/swiftwebui-is-there-an-opportunity-for-leaf-to-support-swiftui-for-the-web/79259)

<div class="topic-metadata">

**Author:** [@powwow](https://forums.swift.org/u/powwow)\
**Replies:** 2\
**Last updated:** [April 24, 2025, 12:28pm UTC](https://forums.swift.org/t/swiftwebui-is-there-an-opportunity-for-leaf-to-support-swiftui-for-the-web/79259 "2025-04-24T12:28:38Z")

</div>

I have been reviewing the following initiative \[GitHub - SwiftWebUI/SwiftWebUI: A demo implementation of SwiftUI for the Web\] as its an initial implementation of SwiftWebUI and is self declared as a "Toy Project" I was…

---

## [Leaf #extend leads to indentation issues in final HTML](https://forums.swift.org/t/leaf-extend-leads-to-indentation-issues-in-final-html/78952)

<div class="topic-metadata">

**Author:** [@mottzi](https://forums.swift.org/u/mottzi)\
**Replies:** 2\
**Last updated:** [April 1, 2025, 4:47pm UTC](https://forums.swift.org/t/leaf-extend-leads-to-indentation-issues-in-final-html/78952 "2025-04-01T16:47:05Z")

</div>

Hey guys, I have two templates: InitialDummies.leaf: \<!DOCTYPE html\> \<html\> \<head\> \<style\> th, td { padding: 0 15px; } \</style\> \</head\> \<body\> \<table\> \<thead\> \<tr\> …

---

## [Reusable parametric components (custom tag?)](https://forums.swift.org/t/reusable-parametric-components-custom-tag/76891)

<div class="topic-metadata">

**Author:** [@pelatho](https://forums.swift.org/u/pelatho)\
**Replies:** 1\
**Last updated:** [January 1, 2025, 9:43pm UTC](https://forums.swift.org/t/reusable-parametric-components-custom-tag/76891 "2025-01-01T21:43:16Z")

</div>

I'm completely new to swift and vapor, so excuse my ignorance, but.... So we've got the extend tag in Leaf which can be used to include a reusable component. However, it's a bit tedious to have to use extend with import…

---

## [Vapor Leaf use sub context](https://forums.swift.org/t/vapor-leaf-use-sub-context/69136)

<div class="topic-metadata">

**Author:** [@wheelius](https://forums.swift.org/u/wheelius)\
**Replies:** 4\
**Last updated:** [February 8, 2024, 11:21pm UTC](https://forums.swift.org/t/vapor-leaf-use-sub-context/69136 "2024-02-08T23:21:25Z")

</div>

Hi all, it seems with the #extend tag in Leaf the context is automatically passed from the renderer. However if you have a more complicated (or nested) context, it doesn't seem to know how to separate keys. For example i…

---

## [LeafEncoder calls fatalerror when child class implements custom encode(to:)](https://forums.swift.org/t/leafencoder-calls-fatalerror-when-child-class-implements-custom-encode-to/69737)

<div class="topic-metadata">

**Author:** [@wheelius](https://forums.swift.org/u/wheelius)\
**Replies:** 0\
**Last updated:** [January 30, 2024, 10:26pm UTC](https://forums.swift.org/t/leafencoder-calls-fatalerror-when-child-class-implements-custom-encode-to/69737 "2024-01-30T22:26:39Z")

</div>

Hey all trying to work with contexts in leaf but running into some issues. When trying to encode a child class that implements a custom encodable conformance, the LeafEncoder calls fatalerror(). Here is example code: c…

---

## [Vapor Leaf embed reusable component](https://forums.swift.org/t/vapor-leaf-embed-reusable-component/69115)

<div class="topic-metadata">

**Author:** [@wheelius](https://forums.swift.org/u/wheelius)\
**Replies:** 3\
**Last updated:** [January 1, 2024, 3:05pm UTC](https://forums.swift.org/t/vapor-leaf-embed-reusable-component/69115 "2024-01-01T15:05:01Z")

</div>

Hi all I am new to Leaf (and HTML templating in general). I am running into an issue with reusable components. I have a div that I want to reuse in many different .leaf files. Right now the only way I see to do something…

---

## [Can I call extend or export functions inside a custom Leaf tag?](https://forums.swift.org/t/can-i-call-extend-or-export-functions-inside-a-custom-leaf-tag/68086)

<div class="topic-metadata">

**Author:** [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Replies:** 2\
**Last updated:** [October 31, 2023, 4:56pm UTC](https://forums.swift.org/t/can-i-call-extend-or-export-functions-inside-a-custom-leaf-tag/68086 "2023-10-31T16:56:11Z")

</div>

Hi. Can I call #extend or #export inbuilt tags inside my own custom Leaf tag? Or is it possible to load a leaf template from a string instead of a file? What I am trying to achieve is to be able to load outer (layout) H…

---

## [Leaf check if user is authenticated](https://forums.swift.org/t/leaf-check-if-user-is-authenticated/62709)

<div class="topic-metadata">

**Author:** [@henrikac](https://forums.swift.org/u/henrikac)\
**Replies:** 4\
**Last updated:** [January 22, 2023, 2:59pm UTC](https://forums.swift.org/t/leaf-check-if-user-is-authenticated/62709 "2023-01-22T14:59:30Z")

</div>

Hi, I finally got the authentication for my app set up and the next task is now to check inside Leaf templates whether the user is authenticated or not. I figured that, in the templates, I could do something like #if(u…

---

## [Rendering leaf form errors](https://forums.swift.org/t/rendering-leaf-form-errors/62641)

<div class="topic-metadata">

**Author:** [@henrikac](https://forums.swift.org/u/henrikac)\
**Replies:** 6\
**Last updated:** [January 19, 2023, 8:18pm UTC](https://forums.swift.org/t/rendering-leaf-form-errors/62641 "2023-01-19T20:18:59Z")

</div>

Hi, I have been searching in the documentation and all over Google all evening to find out how I would render form errors for individual form fields in Leaf - something like this \<form method="POST"\> \<input type="e…
