@fluixi/head

中文文档
1.0.0-alpha.108发布于 2026/11/07MITTypeScriptESM + CJS零依赖近 30 天下载 6156

Built-in reactive, SSR-first SEO & document-head management for Fluixi — title, meta, Open Graph, Twitter, JSON-LD, canonical, hreflang, sitemap & robots.

原始使用文档
文档目录6 节
  1. What it does
  2. Surface
  3. JSON-LD helpers
  4. Components
  5. Sitemap & robots
  6. Status

@fluixi/head

Built-in, reactive, SSR-first SEO & document-head management for Fluixi. No external library: it's a core part of the framework.

import { seo, jsonld } from '@fluixi/head';

seo({
  title: 'Home',
  titleTemplate: '%s · Fluixi',
  description: 'A fine-grained reactive framework.',
  canonical: 'https://fluixi.com/',
  og: { type: 'website', image: 'https://fluixi.com/og.png', siteName: 'Fluixi' },
  twitter: { card: 'summary_large_image', site: '@fluixi' },
  jsonLd: jsonld.website({ name: 'Fluixi', url: 'https://fluixi.com', searchUrl: 'https://fluixi.com/s?q=' }),
});

What it does

  • Reactive: pass a signal (or a function reading one) and the document updates live:
    const title = $signal('Dashboard');
    seo(() => ({ title: title() })); // document.title tracks the signal — no reload
    
  • SSR-first: renderHead(registry) serializes the resolved tags into <head> markup plus <html> attributes; the client reconciler reuses those tags by key → no hydration mismatch.
  • Deduplicated: one title, one description, one canonical; repeatable tags (extra og:image, hreflang alternates, JSON-LD) accumulate. Last write wins for singletons.
  • Nested inheritance: register from a layout, then a page; child values override, arrays merge.
  • Typed: every property is typed, including Open Graph, Twitter, robots, icons, verification.

Surface

title, titleTemplate, description, keywords, author, robots (string or object), canonical, lang, themeColor, viewport, charset, generator, applicationName, referrer, colorScheme, manifest, Open Graph (incl. multiple images, video, audio, article/book/profile), Twitter cards, JSON-LD, alternates (hreflang), feeds (RSS), icons (favicon/apple/mask/shortcut/ms-tile), verification (google/bing/yandex/pinterest), base, and meta/link/script escape hatches.

JSON-LD helpers

jsonld.organization · person · website · webPage · searchAction · article · blogPosting · faq · product · breadcrumb · videoObject · event · localBusiness · softwareApplication · custom.

Components

<Title>, <Meta>, <Link>, <Script>, <Base>, <JsonLD>: render nothing, register metadata, work on server + client (a signal passed in updates the document live).

Sitemap & robots

Pure generators: generateSitemap(entries) (lastmod / changefreq / priority / hreflang / images / videos), chunkSitemap + generateSitemapIndex (50k splitting), and generateRobots(opts) (rules / host / sitemaps, environment-aware disallow-all for previews).

Status

This is the engine (Phase 1): registry + resolution/dedupe + SSR serialize + reactive client reconcile + JSON-LD + components + sitemap/robots generators, fully tested.

Planned integrations (Phase 2): seo route exports + nested-layout wiring in @fluixi/router, automatic <head> injection in the @fluixi/server SSR/stream pipeline, robots.txt/sitemap.xml emission from the @fluixi/start build, a devtools panel, an SEO validator, and an image-metadata pipeline.

版本与发布记录

@fluixi/head 共发布 56 个版本,首次发布于 2026/07/10;过去 12 个月发布了 56 个版本。

版本发布日期距今
1.0.0-alpha.108latest2026/11/078 天前
1.0.0-alpha.1072026/11/0511 天前
1.0.0-alpha.1062026/11/0213 天前
1.0.0-alpha.1052026/11/0115 天前
1.0.0-alpha.1042026/11/0115 天前
1.0.0-alpha.1032026/10/2620 天前

关于 @fluixi/head 的常见问题

@fluixi/head 是什么?

Built-in reactive, SSR-first SEO & document-head management for Fluixi — title, meta, Open Graph, Twitter, JSON-LD, canonical, hreflang, sitemap & robots.

如何安装 @fluixi/head?

在项目目录运行 npm install @fluixi/head,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@fluixi/reactive(^1.0.0-alpha.108)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fluixi/head 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fluixi/head 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fluixi/head 可以商用吗?

@fluixi/head 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fluixi/head 的下载量有多少?

根据 npm 官方下载统计,@fluixi/head 在 2026/10/15 – 2026/11/13 这 30 天内被下载 6,156 次,日均约 205 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fluixi/head 还在维护吗?

最新版本 1.0.0-alpha.108 发布于 2026/11/07(8 天前);至今共发布 56 个版本,其中过去 12 个月发布了 56 个;首次发布于 2026/07/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。