@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/head

Example#

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#

FunctionWhat 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#

  • Client-side only — no SSR/prerender, so JS-less crawlers won't see it.
  • One-time set, not a binding; call it again if the title depends on changing state.
  • name-based meta only (no http-equiv or OpenGraph property).