@zoijs/head
Set the page title and meta description from a component, with restore-on-cleanup so routed pages revert automatically.
npm install @zoijs/core @zoijs/headExample#
import { html } from "@zoijs/core";
import { title, description } from "@zoijs/head";
function About() {
title("About | My App");
description("Learn more about this Zoijs app.");
return html`<h1>About</h1>`;
}Each setter snapshots the current value and restores it when the component unmounts — so navigating between pages updates the tab title with no head manager.
This site uses
@zoijs/head: every page you visit updates the browser-tab title. Built with the router, it just works.API#
| Function | What it does |
|---|---|
title(value) | Set document.title |
description(value) | Set <meta name="description"> (creates it if missing) |
meta(name, content) | Set any name-based meta tag |
Known limitations#
- Sets
document.title/meta on the client, so they aren't part of the server-rendered HTML. Under@zoijs/ssrthe setters are a safe no-op (they never throw duringrenderToString): put the initial<title>/<meta>in your HTML shell andheadupdates them after hydration. - One-time set, not a binding; call it again if the title depends on changing state.
name-based meta only (nohttp-equivor OpenGraphproperty).