@nexus_js/head 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +284 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nexus Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @nexus_js/head
|
|
2
|
+
|
|
3
|
+
Nexus Head — reactive SEO metadata manager for Islands Architecture.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
All guides, API reference, and examples live on **[nexusjs.dev](https://nexusjs.dev)**.
|
|
8
|
+
|
|
9
|
+
## Links
|
|
10
|
+
|
|
11
|
+
- **Website:** [https://nexusjs.dev](https://nexusjs.dev)
|
|
12
|
+
- **Repository:** [github.com/bierfor/nexus](https://github.com/bierfor/nexus) (see `packages/head/`)
|
|
13
|
+
- **Issues:** [github.com/bierfor/nexus/issues](https://github.com/bierfor/nexus/issues)
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
MIT © Nexus contributors
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nexus Head — Reactive SEO metadata manager.
|
|
3
|
+
*
|
|
4
|
+
* The problem with Islands Architecture:
|
|
5
|
+
* Metadata lives in <head> but components are islands deep in <body>.
|
|
6
|
+
* A product detail island needs to update the page <title> and og:image,
|
|
7
|
+
* but it has no easy DOM path to <head>.
|
|
8
|
+
*
|
|
9
|
+
* Nexus Head solves this with two mechanisms:
|
|
10
|
+
*
|
|
11
|
+
* 1. SERVER: `defineHead()` in a component's server block injects metadata
|
|
12
|
+
* statically into the SSR'd HTML — perfect for crawlers.
|
|
13
|
+
*
|
|
14
|
+
* 2. CLIENT: `useHead()` in an island script reactively updates <head>
|
|
15
|
+
* tags when state changes — perfect for SPAs and dynamic routes.
|
|
16
|
+
*
|
|
17
|
+
* Usage (server block — static, zero JS):
|
|
18
|
+
* ---
|
|
19
|
+
* defineHead({
|
|
20
|
+
* title: `${post.title} | My Blog`,
|
|
21
|
+
* description: post.excerpt,
|
|
22
|
+
* og: { image: post.coverImage, type: 'article' },
|
|
23
|
+
* canonical: `/blog/${post.slug}`,
|
|
24
|
+
* });
|
|
25
|
+
* ---
|
|
26
|
+
*
|
|
27
|
+
* Usage (island script — reactive):
|
|
28
|
+
* <script>
|
|
29
|
+
* let query = $state('');
|
|
30
|
+
* useHead(() => ({ title: `Search: ${query.value}` }));
|
|
31
|
+
* </script>
|
|
32
|
+
*/
|
|
33
|
+
export interface HeadMeta {
|
|
34
|
+
/** Page title (also sets og:title and twitter:title by default) */
|
|
35
|
+
title?: string;
|
|
36
|
+
/** Append site name: "Post Title | My Site" */
|
|
37
|
+
titleTemplate?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
keywords?: string | string[];
|
|
40
|
+
canonical?: string;
|
|
41
|
+
robots?: string | RobotsDirective;
|
|
42
|
+
/** Viewport meta */
|
|
43
|
+
viewport?: string;
|
|
44
|
+
/** Open Graph metadata */
|
|
45
|
+
og?: OpenGraphMeta;
|
|
46
|
+
/** Twitter Card metadata */
|
|
47
|
+
twitter?: TwitterMeta;
|
|
48
|
+
/** JSON-LD structured data */
|
|
49
|
+
jsonLd?: Record<string, unknown> | Record<string, unknown>[];
|
|
50
|
+
/** Arbitrary <link> tags */
|
|
51
|
+
links?: LinkTag[];
|
|
52
|
+
/** Arbitrary <meta> tags */
|
|
53
|
+
metas?: MetaTag[];
|
|
54
|
+
/** <script> tags to inject into head */
|
|
55
|
+
scripts?: ScriptTag[];
|
|
56
|
+
/** Theme color */
|
|
57
|
+
themeColor?: string;
|
|
58
|
+
/** Favicon href */
|
|
59
|
+
favicon?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface OpenGraphMeta {
|
|
62
|
+
title?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
image?: string;
|
|
65
|
+
imageAlt?: string;
|
|
66
|
+
imageWidth?: number;
|
|
67
|
+
imageHeight?: number;
|
|
68
|
+
url?: string;
|
|
69
|
+
type?: 'website' | 'article' | 'product' | 'profile' | string;
|
|
70
|
+
siteName?: string;
|
|
71
|
+
locale?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface TwitterMeta {
|
|
74
|
+
card?: 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
75
|
+
site?: string;
|
|
76
|
+
creator?: string;
|
|
77
|
+
title?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
image?: string;
|
|
80
|
+
imageAlt?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface LinkTag {
|
|
83
|
+
rel: string;
|
|
84
|
+
href: string;
|
|
85
|
+
type?: string;
|
|
86
|
+
hreflang?: string;
|
|
87
|
+
sizes?: string;
|
|
88
|
+
crossorigin?: string;
|
|
89
|
+
[key: string]: string | undefined;
|
|
90
|
+
}
|
|
91
|
+
export interface MetaTag {
|
|
92
|
+
name?: string;
|
|
93
|
+
property?: string;
|
|
94
|
+
httpEquiv?: string;
|
|
95
|
+
content: string;
|
|
96
|
+
charset?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ScriptTag {
|
|
99
|
+
src?: string;
|
|
100
|
+
type?: string;
|
|
101
|
+
async?: boolean;
|
|
102
|
+
defer?: boolean;
|
|
103
|
+
content?: string;
|
|
104
|
+
}
|
|
105
|
+
export type RobotsDirective = {
|
|
106
|
+
index?: boolean;
|
|
107
|
+
follow?: boolean;
|
|
108
|
+
noarchive?: boolean;
|
|
109
|
+
nosnippet?: boolean;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Called in server blocks to define page metadata.
|
|
113
|
+
* Collected during SSR and injected into <head>.
|
|
114
|
+
*/
|
|
115
|
+
export declare function defineHead(meta: HeadMeta): void;
|
|
116
|
+
/**
|
|
117
|
+
* Collects and clears the head stack for the current request.
|
|
118
|
+
* Called by the renderer to inject <head> content.
|
|
119
|
+
*/
|
|
120
|
+
export declare function flushHead(): HeadMeta[];
|
|
121
|
+
/**
|
|
122
|
+
* Renders collected HeadMeta into <head> HTML string.
|
|
123
|
+
* Called by the SSR renderer to inject into the document.
|
|
124
|
+
*/
|
|
125
|
+
export declare function renderHeadToString(metas: HeadMeta[]): string;
|
|
126
|
+
/**
|
|
127
|
+
* Reactively updates <head> metadata from an island.
|
|
128
|
+
* Uses $effect to re-run whenever dependencies change.
|
|
129
|
+
*
|
|
130
|
+
* @param meta - A function returning HeadMeta (can reference $state signals)
|
|
131
|
+
*/
|
|
132
|
+
export declare function useHead(meta: () => HeadMeta): void;
|
|
133
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,MAAM,WAAW,QAAQ;IACvB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IAClC,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,EAAE,CAAC,EAAE,aAAa,CAAC;IACnB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC7D,4BAA4B;IAC5B,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,wCAAwC;IACxC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,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AI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAMF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAE/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,QAAQ,EAAE,CAItC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAI5D;AAOD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,QAAQ,GAAG,IAAI,CAOlD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nexus Head — Reactive SEO metadata manager.
|
|
3
|
+
*
|
|
4
|
+
* The problem with Islands Architecture:
|
|
5
|
+
* Metadata lives in <head> but components are islands deep in <body>.
|
|
6
|
+
* A product detail island needs to update the page <title> and og:image,
|
|
7
|
+
* but it has no easy DOM path to <head>.
|
|
8
|
+
*
|
|
9
|
+
* Nexus Head solves this with two mechanisms:
|
|
10
|
+
*
|
|
11
|
+
* 1. SERVER: `defineHead()` in a component's server block injects metadata
|
|
12
|
+
* statically into the SSR'd HTML — perfect for crawlers.
|
|
13
|
+
*
|
|
14
|
+
* 2. CLIENT: `useHead()` in an island script reactively updates <head>
|
|
15
|
+
* tags when state changes — perfect for SPAs and dynamic routes.
|
|
16
|
+
*
|
|
17
|
+
* Usage (server block — static, zero JS):
|
|
18
|
+
* ---
|
|
19
|
+
* defineHead({
|
|
20
|
+
* title: `${post.title} | My Blog`,
|
|
21
|
+
* description: post.excerpt,
|
|
22
|
+
* og: { image: post.coverImage, type: 'article' },
|
|
23
|
+
* canonical: `/blog/${post.slug}`,
|
|
24
|
+
* });
|
|
25
|
+
* ---
|
|
26
|
+
*
|
|
27
|
+
* Usage (island script — reactive):
|
|
28
|
+
* <script>
|
|
29
|
+
* let query = $state('');
|
|
30
|
+
* useHead(() => ({ title: `Search: ${query.value}` }));
|
|
31
|
+
* </script>
|
|
32
|
+
*/
|
|
33
|
+
import { $effect } from '@nexus_js/runtime';
|
|
34
|
+
// ── Server-side: collect metadata for SSR injection ───────────────────────────
|
|
35
|
+
const _headStack = [];
|
|
36
|
+
/**
|
|
37
|
+
* Called in server blocks to define page metadata.
|
|
38
|
+
* Collected during SSR and injected into <head>.
|
|
39
|
+
*/
|
|
40
|
+
export function defineHead(meta) {
|
|
41
|
+
_headStack.push(meta);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Collects and clears the head stack for the current request.
|
|
45
|
+
* Called by the renderer to inject <head> content.
|
|
46
|
+
*/
|
|
47
|
+
export function flushHead() {
|
|
48
|
+
const heads = [..._headStack];
|
|
49
|
+
_headStack.length = 0;
|
|
50
|
+
return heads;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Renders collected HeadMeta into <head> HTML string.
|
|
54
|
+
* Called by the SSR renderer to inject into the document.
|
|
55
|
+
*/
|
|
56
|
+
export function renderHeadToString(metas) {
|
|
57
|
+
// Merge all head metas (later entries override earlier)
|
|
58
|
+
const merged = mergeMetas(metas);
|
|
59
|
+
return buildHeadHTML(merged);
|
|
60
|
+
}
|
|
61
|
+
// ── Client-side: reactive head updates ───────────────────────────────────────
|
|
62
|
+
/** Tracks applied head elements for cleanup */
|
|
63
|
+
const appliedElements = [];
|
|
64
|
+
/**
|
|
65
|
+
* Reactively updates <head> metadata from an island.
|
|
66
|
+
* Uses $effect to re-run whenever dependencies change.
|
|
67
|
+
*
|
|
68
|
+
* @param meta - A function returning HeadMeta (can reference $state signals)
|
|
69
|
+
*/
|
|
70
|
+
export function useHead(meta) {
|
|
71
|
+
if (typeof document === 'undefined')
|
|
72
|
+
return;
|
|
73
|
+
$effect(() => {
|
|
74
|
+
const resolved = meta();
|
|
75
|
+
applyHeadToDom(resolved);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function applyHeadToDom(meta) {
|
|
79
|
+
// Clean up previously applied elements
|
|
80
|
+
for (const el of appliedElements)
|
|
81
|
+
el.remove();
|
|
82
|
+
appliedElements.length = 0;
|
|
83
|
+
const head = document.head;
|
|
84
|
+
const inject = (el) => {
|
|
85
|
+
head.appendChild(el);
|
|
86
|
+
appliedElements.push(el);
|
|
87
|
+
};
|
|
88
|
+
// Title
|
|
89
|
+
if (meta.title) {
|
|
90
|
+
const title = meta.titleTemplate
|
|
91
|
+
? meta.titleTemplate.replace('%s', meta.title)
|
|
92
|
+
: meta.title;
|
|
93
|
+
document.title = title;
|
|
94
|
+
}
|
|
95
|
+
// Description
|
|
96
|
+
if (meta.description) {
|
|
97
|
+
inject(createMeta({ name: 'description', content: meta.description }));
|
|
98
|
+
}
|
|
99
|
+
// Keywords
|
|
100
|
+
if (meta.keywords) {
|
|
101
|
+
const kw = Array.isArray(meta.keywords) ? meta.keywords.join(', ') : meta.keywords;
|
|
102
|
+
inject(createMeta({ name: 'keywords', content: kw }));
|
|
103
|
+
}
|
|
104
|
+
// Canonical
|
|
105
|
+
if (meta.canonical) {
|
|
106
|
+
inject(createLink({ rel: 'canonical', href: meta.canonical }));
|
|
107
|
+
}
|
|
108
|
+
// Robots
|
|
109
|
+
if (meta.robots) {
|
|
110
|
+
const content = typeof meta.robots === 'string'
|
|
111
|
+
? meta.robots
|
|
112
|
+
: robotsToString(meta.robots);
|
|
113
|
+
inject(createMeta({ name: 'robots', content }));
|
|
114
|
+
}
|
|
115
|
+
// Open Graph
|
|
116
|
+
if (meta.og) {
|
|
117
|
+
const og = meta.og;
|
|
118
|
+
const title = og.title ?? meta.title;
|
|
119
|
+
if (title)
|
|
120
|
+
inject(createMeta({ property: 'og:title', content: title }));
|
|
121
|
+
const desc = og.description ?? meta.description;
|
|
122
|
+
if (desc)
|
|
123
|
+
inject(createMeta({ property: 'og:description', content: desc }));
|
|
124
|
+
if (og.image)
|
|
125
|
+
inject(createMeta({ property: 'og:image', content: og.image }));
|
|
126
|
+
if (og.imageAlt)
|
|
127
|
+
inject(createMeta({ property: 'og:image:alt', content: og.imageAlt }));
|
|
128
|
+
if (og.imageWidth)
|
|
129
|
+
inject(createMeta({ property: 'og:image:width', content: String(og.imageWidth) }));
|
|
130
|
+
if (og.imageHeight)
|
|
131
|
+
inject(createMeta({ property: 'og:image:height', content: String(og.imageHeight) }));
|
|
132
|
+
if (og.url)
|
|
133
|
+
inject(createMeta({ property: 'og:url', content: og.url }));
|
|
134
|
+
if (og.type)
|
|
135
|
+
inject(createMeta({ property: 'og:type', content: og.type }));
|
|
136
|
+
if (og.siteName)
|
|
137
|
+
inject(createMeta({ property: 'og:site_name', content: og.siteName }));
|
|
138
|
+
if (og.locale)
|
|
139
|
+
inject(createMeta({ property: 'og:locale', content: og.locale }));
|
|
140
|
+
}
|
|
141
|
+
// Twitter
|
|
142
|
+
if (meta.twitter) {
|
|
143
|
+
const t = meta.twitter;
|
|
144
|
+
if (t.card)
|
|
145
|
+
inject(createMeta({ name: 'twitter:card', content: t.card }));
|
|
146
|
+
if (t.site)
|
|
147
|
+
inject(createMeta({ name: 'twitter:site', content: t.site }));
|
|
148
|
+
if (t.creator)
|
|
149
|
+
inject(createMeta({ name: 'twitter:creator', content: t.creator }));
|
|
150
|
+
const title = t.title ?? meta.title;
|
|
151
|
+
if (title)
|
|
152
|
+
inject(createMeta({ name: 'twitter:title', content: title }));
|
|
153
|
+
const desc = t.description ?? meta.description;
|
|
154
|
+
if (desc)
|
|
155
|
+
inject(createMeta({ name: 'twitter:description', content: desc }));
|
|
156
|
+
if (t.image)
|
|
157
|
+
inject(createMeta({ name: 'twitter:image', content: t.image }));
|
|
158
|
+
if (t.imageAlt)
|
|
159
|
+
inject(createMeta({ name: 'twitter:image:alt', content: t.imageAlt }));
|
|
160
|
+
}
|
|
161
|
+
// JSON-LD
|
|
162
|
+
if (meta.jsonLd) {
|
|
163
|
+
const schemas = Array.isArray(meta.jsonLd) ? meta.jsonLd : [meta.jsonLd];
|
|
164
|
+
for (const schema of schemas) {
|
|
165
|
+
const script = document.createElement('script');
|
|
166
|
+
script.type = 'application/ld+json';
|
|
167
|
+
script.textContent = JSON.stringify(schema);
|
|
168
|
+
inject(script);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Theme color
|
|
172
|
+
if (meta.themeColor) {
|
|
173
|
+
inject(createMeta({ name: 'theme-color', content: meta.themeColor }));
|
|
174
|
+
}
|
|
175
|
+
// Arbitrary metas
|
|
176
|
+
for (const m of meta.metas ?? []) {
|
|
177
|
+
inject(createMeta(m));
|
|
178
|
+
}
|
|
179
|
+
// Arbitrary links
|
|
180
|
+
for (const l of meta.links ?? []) {
|
|
181
|
+
inject(createLink(l));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
185
|
+
function createMeta(attrs) {
|
|
186
|
+
const el = document.createElement('meta');
|
|
187
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
188
|
+
if (v !== undefined)
|
|
189
|
+
el.setAttribute(k, String(v));
|
|
190
|
+
}
|
|
191
|
+
return el;
|
|
192
|
+
}
|
|
193
|
+
function createLink(attrs) {
|
|
194
|
+
const el = document.createElement('link');
|
|
195
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
196
|
+
if (v !== undefined)
|
|
197
|
+
el.setAttribute(k, v);
|
|
198
|
+
}
|
|
199
|
+
return el;
|
|
200
|
+
}
|
|
201
|
+
function robotsToString(r) {
|
|
202
|
+
const parts = [];
|
|
203
|
+
if (r.index === false)
|
|
204
|
+
parts.push('noindex');
|
|
205
|
+
else
|
|
206
|
+
parts.push('index');
|
|
207
|
+
if (r.follow === false)
|
|
208
|
+
parts.push('nofollow');
|
|
209
|
+
else
|
|
210
|
+
parts.push('follow');
|
|
211
|
+
if (r.noarchive)
|
|
212
|
+
parts.push('noarchive');
|
|
213
|
+
if (r.nosnippet)
|
|
214
|
+
parts.push('nosnippet');
|
|
215
|
+
return parts.join(', ');
|
|
216
|
+
}
|
|
217
|
+
function mergeMetas(metas) {
|
|
218
|
+
return metas.reduce((acc, m) => ({
|
|
219
|
+
...acc,
|
|
220
|
+
...m,
|
|
221
|
+
og: { ...acc.og, ...m.og },
|
|
222
|
+
twitter: { ...acc.twitter, ...m.twitter },
|
|
223
|
+
metas: [...(acc.metas ?? []), ...(m.metas ?? [])],
|
|
224
|
+
links: [...(acc.links ?? []), ...(m.links ?? [])],
|
|
225
|
+
scripts: [...(acc.scripts ?? []), ...(m.scripts ?? [])],
|
|
226
|
+
}), {});
|
|
227
|
+
}
|
|
228
|
+
function buildHeadHTML(meta) {
|
|
229
|
+
const tags = [];
|
|
230
|
+
if (meta.viewport) {
|
|
231
|
+
tags.push(`<meta name="viewport" content="${esc(meta.viewport)}">`);
|
|
232
|
+
}
|
|
233
|
+
if (meta.title) {
|
|
234
|
+
const title = meta.titleTemplate
|
|
235
|
+
? meta.titleTemplate.replace('%s', meta.title)
|
|
236
|
+
: meta.title;
|
|
237
|
+
tags.push(`<title>${esc(title)}</title>`);
|
|
238
|
+
tags.push(`<meta property="og:title" content="${esc(title)}">`);
|
|
239
|
+
tags.push(`<meta name="twitter:title" content="${esc(title)}">`);
|
|
240
|
+
}
|
|
241
|
+
if (meta.description) {
|
|
242
|
+
tags.push(`<meta name="description" content="${esc(meta.description)}">`);
|
|
243
|
+
tags.push(`<meta property="og:description" content="${esc(meta.description)}">`);
|
|
244
|
+
tags.push(`<meta name="twitter:description" content="${esc(meta.description)}">`);
|
|
245
|
+
}
|
|
246
|
+
if (meta.canonical) {
|
|
247
|
+
tags.push(`<link rel="canonical" href="${esc(meta.canonical)}">`);
|
|
248
|
+
tags.push(`<meta property="og:url" content="${esc(meta.canonical)}">`);
|
|
249
|
+
}
|
|
250
|
+
if (meta.og?.image) {
|
|
251
|
+
tags.push(`<meta property="og:image" content="${esc(meta.og.image)}">`);
|
|
252
|
+
tags.push(`<meta name="twitter:image" content="${esc(meta.og.image)}">`);
|
|
253
|
+
tags.push(`<link rel="preload" as="image" href="${esc(meta.og.image)}">`);
|
|
254
|
+
}
|
|
255
|
+
if (meta.jsonLd) {
|
|
256
|
+
const schemas = Array.isArray(meta.jsonLd) ? meta.jsonLd : [meta.jsonLd];
|
|
257
|
+
for (const s of schemas) {
|
|
258
|
+
tags.push(`<script type="application/ld+json">${JSON.stringify(s)}</script>`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (meta.themeColor) {
|
|
262
|
+
tags.push(`<meta name="theme-color" content="${esc(meta.themeColor)}">`);
|
|
263
|
+
}
|
|
264
|
+
if (meta.favicon) {
|
|
265
|
+
tags.push(`<link rel="icon" href="${esc(meta.favicon)}">`);
|
|
266
|
+
}
|
|
267
|
+
for (const m of meta.metas ?? []) {
|
|
268
|
+
const attrs = Object.entries(m)
|
|
269
|
+
.map(([k, v]) => `${k}="${esc(String(v))}"`)
|
|
270
|
+
.join(' ');
|
|
271
|
+
tags.push(`<meta ${attrs}>`);
|
|
272
|
+
}
|
|
273
|
+
for (const l of meta.links ?? []) {
|
|
274
|
+
const attrs = Object.entries(l)
|
|
275
|
+
.map(([k, v]) => `${k}="${esc(String(v))}"`)
|
|
276
|
+
.join(' ');
|
|
277
|
+
tags.push(`<link ${attrs}>`);
|
|
278
|
+
}
|
|
279
|
+
return tags.join('\n ');
|
|
280
|
+
}
|
|
281
|
+
function esc(s) {
|
|
282
|
+
return s.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<');
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;aAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;aAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;aAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;aAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,GAAG,CAAC,CAAS;IACpB,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAChF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nexus_js/head",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Nexus Head — reactive SEO metadata manager for Islands Architecture",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@nexus_js/runtime": "0.6.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.0.0",
|
|
19
|
+
"typescript": "^5.5.0"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"homepage": "https://nexusjs.dev",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/bierfor/nexus.git",
|
|
26
|
+
"directory": "packages/head"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/bierfor/nexus/issues"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"nexus",
|
|
33
|
+
"framework",
|
|
34
|
+
"full-stack",
|
|
35
|
+
"svelte",
|
|
36
|
+
"islands",
|
|
37
|
+
"ssr",
|
|
38
|
+
"vite",
|
|
39
|
+
"server-actions"
|
|
40
|
+
],
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public",
|
|
47
|
+
"registry": "https://registry.npmjs.org/"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc -p tsconfig.json",
|
|
51
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
52
|
+
"clean": "rm -rf dist"
|
|
53
|
+
}
|
|
54
|
+
}
|