datastar/site/static/md/examples/title_update_backend.md

752 B

Title Update Backend

Demo

Look at the title change in the browser tab!

Explanation

A user in the Discord channel was asking about needing a plugin similar to HTMX's head support to update title or head elements. With Datastar this is unnecessary as you can just update the title directly with an SSE fragment

event: datastar-merge-fragments
data: selector title
data: fragments <title>08:30:36 from server</title>

In a similar fashion you can append, prepend directly to the HEAD element using Merge Options