head extension mishandles title
Author: scrhartleyCreated Sep 12, 2026Updated Sep 17, 2026
The trouble with the title tag appears when using the extension with hx-head="append".
The title is something that intrinsically changes between pages and so when using append it will cause multiple titles to appear.
The problem affects the extension for both htmx v2 and v4.
For my local workaround, I disable title handing entirely, since htmx already handles titles itself and so there's an argument that it's not the extension's responsibility to manage them at all.
Here is a simple reproduction with two pages using boosting. Toggling between the two results in multiple title elements. Page 1
<!DOCTYPE html>
<html>
<head hx-head="append">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/htmx.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ext/hx-head.js"></script>
<title>Page 1</title>
</head>
<body hx-boost:inherited="true">
<a href="page2.html">Page 2</a>
</body>
</html>
Page 2
<!DOCTYPE html>
<html>
<head hx-head="append">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/htmx.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ext/hx-head.js"></script>
<title>Page 2</title>
</head>
<body hx-boost:inherited="true">
<a href="page1.html">Page 1</a>
</body>
</html>
Source: bigskysoftware/htmx