@actuate-media/plugin-seo 0.0.1
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/dist/admin/GooglePreview.d.ts +9 -0
- package/dist/admin/GooglePreview.d.ts.map +1 -0
- package/dist/admin/GooglePreview.js +67 -0
- package/dist/admin/GooglePreview.js.map +1 -0
- package/dist/admin/SEOPanel.d.ts +11 -0
- package/dist/admin/SEOPanel.d.ts.map +1 -0
- package/dist/admin/SEOPanel.js +65 -0
- package/dist/admin/SEOPanel.js.map +1 -0
- package/dist/admin/SchemaPreview.d.ts +7 -0
- package/dist/admin/SchemaPreview.d.ts.map +1 -0
- package/dist/admin/SchemaPreview.js +83 -0
- package/dist/admin/SchemaPreview.js.map +1 -0
- package/dist/canonical/index.d.ts +16 -0
- package/dist/canonical/index.d.ts.map +1 -0
- package/dist/canonical/index.js +77 -0
- package/dist/canonical/index.js.map +1 -0
- package/dist/collections.d.ts +3 -0
- package/dist/collections.d.ts.map +1 -0
- package/dist/collections.js +2 -0
- package/dist/collections.js.map +1 -0
- package/dist/fields.d.ts +3 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +115 -0
- package/dist/fields.js.map +1 -0
- package/dist/hooks.d.ts +5 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +29 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/link-health/index.d.ts +24 -0
- package/dist/link-health/index.d.ts.map +1 -0
- package/dist/link-health/index.js +82 -0
- package/dist/link-health/index.js.map +1 -0
- package/dist/og-image/index.d.ts +11 -0
- package/dist/og-image/index.d.ts.map +1 -0
- package/dist/og-image/index.js +28 -0
- package/dist/og-image/index.js.map +1 -0
- package/dist/robots/index.d.ts +14 -0
- package/dist/robots/index.d.ts.map +1 -0
- package/dist/robots/index.js +48 -0
- package/dist/robots/index.js.map +1 -0
- package/dist/schema/auto-detect.d.ts +3 -0
- package/dist/schema/auto-detect.d.ts.map +1 -0
- package/dist/schema/auto-detect.js +28 -0
- package/dist/schema/auto-detect.js.map +1 -0
- package/dist/schema/composer.d.ts +3 -0
- package/dist/schema/composer.d.ts.map +1 -0
- package/dist/schema/composer.js +72 -0
- package/dist/schema/composer.js.map +1 -0
- package/dist/schema/registry.d.ts +170 -0
- package/dist/schema/registry.d.ts.map +1 -0
- package/dist/schema/registry.js +2 -0
- package/dist/schema/registry.js.map +1 -0
- package/dist/schema/validator.d.ts +11 -0
- package/dist/schema/validator.d.ts.map +1 -0
- package/dist/schema/validator.js +107 -0
- package/dist/schema/validator.js.map +1 -0
- package/dist/sitemap/index.d.ts +78 -0
- package/dist/sitemap/index.d.ts.map +1 -0
- package/dist/sitemap/index.js +186 -0
- package/dist/sitemap/index.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface GooglePreviewProps {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
/** Renders a live SERP preview mimicking Google search result appearance. */
|
|
7
|
+
export declare function GooglePreview({ title, description, url }: GooglePreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=GooglePreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GooglePreview.d.ts","sourceRoot":"","sources":["../../src/admin/GooglePreview.tsx"],"names":[],"mappings":"AAIA,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,kBAAkB,2CA2E5E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/** Renders a live SERP preview mimicking Google search result appearance. */
|
|
4
|
+
export function GooglePreview({ title, description, url }) {
|
|
5
|
+
const displayUrl = formatDisplayUrl(url);
|
|
6
|
+
const truncatedTitle = title.length > 60 ? `${title.slice(0, 57)}...` : title;
|
|
7
|
+
const truncatedDescription = description.length > 155 ? `${description.slice(0, 152)}...` : description;
|
|
8
|
+
return (_jsxs("div", { style: { fontFamily: 'Arial, sans-serif', maxWidth: '600px', padding: '16px' }, children: [_jsx("div", { style: { fontSize: '12px', color: '#70757a', marginBottom: '2px' }, children: "Search preview" }), _jsxs("div", { style: {
|
|
9
|
+
border: '1px solid #dfe1e5',
|
|
10
|
+
borderRadius: '8px',
|
|
11
|
+
padding: '16px',
|
|
12
|
+
background: '#fff',
|
|
13
|
+
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px', marginBottom: '8px' }, children: [_jsx("div", { style: {
|
|
14
|
+
width: '28px',
|
|
15
|
+
height: '28px',
|
|
16
|
+
borderRadius: '50%',
|
|
17
|
+
background: '#f1f3f4',
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
fontSize: '14px',
|
|
22
|
+
fontWeight: 700,
|
|
23
|
+
color: '#4285f4',
|
|
24
|
+
flexShrink: 0,
|
|
25
|
+
}, children: getFavicon(url) }), _jsxs("div", { style: { overflow: 'hidden' }, children: [_jsx("div", { style: { fontSize: '14px', color: '#202124', lineHeight: '20px' }, children: getDomain(url) }), _jsx("div", { style: {
|
|
26
|
+
fontSize: '12px',
|
|
27
|
+
color: '#4d5156',
|
|
28
|
+
lineHeight: '18px',
|
|
29
|
+
whiteSpace: 'nowrap',
|
|
30
|
+
overflow: 'hidden',
|
|
31
|
+
textOverflow: 'ellipsis',
|
|
32
|
+
}, children: displayUrl })] })] }), _jsx("div", { style: {
|
|
33
|
+
fontSize: '20px',
|
|
34
|
+
lineHeight: '26px',
|
|
35
|
+
color: '#1a0dab',
|
|
36
|
+
marginBottom: '4px',
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
}, children: truncatedTitle || 'Page Title' }), _jsx("div", { style: { fontSize: '14px', lineHeight: '22px', color: '#4d5156' }, children: truncatedDescription || 'Add a meta description to see how it appears in search results.' })] })] }));
|
|
39
|
+
}
|
|
40
|
+
function formatDisplayUrl(url) {
|
|
41
|
+
try {
|
|
42
|
+
const parsed = new URL(url.startsWith('http') ? url : `https://${url}`);
|
|
43
|
+
return `${parsed.origin}${parsed.pathname}`;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return url;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function getDomain(url) {
|
|
50
|
+
try {
|
|
51
|
+
const parsed = new URL(url.startsWith('http') ? url : `https://${url}`);
|
|
52
|
+
return parsed.hostname;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return url;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function getFavicon(url) {
|
|
59
|
+
try {
|
|
60
|
+
const parsed = new URL(url.startsWith('http') ? url : `https://${url}`);
|
|
61
|
+
return parsed.hostname.charAt(0).toUpperCase();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return 'W';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=GooglePreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GooglePreview.js","sourceRoot":"","sources":["../../src/admin/GooglePreview.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAUb,6EAA6E;AAC7E,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAsB;IAC3E,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzC,MAAM,cAAc,GAAG,KAAK,CAA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AAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface SEOPanelProps {
|
|
2
|
+
metaTitle?: string;
|
|
3
|
+
metaDescription?: string;
|
|
4
|
+
canonicalUrl?: string;
|
|
5
|
+
ogImage?: string;
|
|
6
|
+
onChange?: (field: string, value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
/** Sidebar panel for editing per-page SEO metadata. */
|
|
9
|
+
export declare function SEOPanel({ metaTitle, metaDescription, canonicalUrl, ogImage, onChange, }: SEOPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=SEOPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SEOPanel.d.ts","sourceRoot":"","sources":["../../src/admin/SEOPanel.tsx"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAKD,uDAAuD;AACvD,wBAAgB,QAAQ,CAAC,EACvB,SAAc,EACd,eAAoB,EACpB,YAAiB,EACjB,OAAY,EACZ,QAAQ,GACT,EAAE,aAAa,2CA4Hf"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
const META_TITLE_MAX = 70;
|
|
5
|
+
const META_DESC_MAX = 160;
|
|
6
|
+
/** Sidebar panel for editing per-page SEO metadata. */
|
|
7
|
+
export function SEOPanel({ metaTitle = '', metaDescription = '', canonicalUrl = '', ogImage = '', onChange, }) {
|
|
8
|
+
const [title, setTitle] = useState(metaTitle);
|
|
9
|
+
const [description, setDescription] = useState(metaDescription);
|
|
10
|
+
const [canonical, setCanonical] = useState(canonicalUrl);
|
|
11
|
+
const [image, setImage] = useState(ogImage);
|
|
12
|
+
function handleChange(field, value) {
|
|
13
|
+
onChange?.(field, value);
|
|
14
|
+
}
|
|
15
|
+
const titleLength = title.length;
|
|
16
|
+
const descLength = description.length;
|
|
17
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px', padding: '16px' }, children: [_jsx("h3", { style: { margin: 0, fontSize: '14px', fontWeight: 600, textTransform: 'uppercase', letterSpacing: '0.05em' }, children: "SEO Settings" }), _jsxs("div", { children: [_jsx("label", { style: { display: 'block', fontSize: '13px', fontWeight: 500, marginBottom: '4px' }, children: "Meta Title" }), _jsx("input", { type: "text", value: title, maxLength: META_TITLE_MAX, onChange: (e) => {
|
|
18
|
+
setTitle(e.target.value);
|
|
19
|
+
handleChange('metaTitle', e.target.value);
|
|
20
|
+
}, style: {
|
|
21
|
+
width: '100%',
|
|
22
|
+
padding: '8px',
|
|
23
|
+
border: '1px solid #d1d5db',
|
|
24
|
+
borderRadius: '6px',
|
|
25
|
+
fontSize: '14px',
|
|
26
|
+
boxSizing: 'border-box',
|
|
27
|
+
} }), _jsx(CharacterCount, { current: titleLength, max: META_TITLE_MAX })] }), _jsxs("div", { children: [_jsx("label", { style: { display: 'block', fontSize: '13px', fontWeight: 500, marginBottom: '4px' }, children: "Meta Description" }), _jsx("textarea", { value: description, maxLength: META_DESC_MAX, rows: 3, onChange: (e) => {
|
|
28
|
+
setDescription(e.target.value);
|
|
29
|
+
handleChange('metaDescription', e.target.value);
|
|
30
|
+
}, style: {
|
|
31
|
+
width: '100%',
|
|
32
|
+
padding: '8px',
|
|
33
|
+
border: '1px solid #d1d5db',
|
|
34
|
+
borderRadius: '6px',
|
|
35
|
+
fontSize: '14px',
|
|
36
|
+
resize: 'vertical',
|
|
37
|
+
boxSizing: 'border-box',
|
|
38
|
+
} }), _jsx(CharacterCount, { current: descLength, max: META_DESC_MAX })] }), _jsxs("div", { children: [_jsx("label", { style: { display: 'block', fontSize: '13px', fontWeight: 500, marginBottom: '4px' }, children: "Canonical URL" }), _jsx("input", { type: "url", value: canonical, onChange: (e) => {
|
|
39
|
+
setCanonical(e.target.value);
|
|
40
|
+
handleChange('canonicalUrl', e.target.value);
|
|
41
|
+
}, placeholder: "https://example.com/page", style: {
|
|
42
|
+
width: '100%',
|
|
43
|
+
padding: '8px',
|
|
44
|
+
border: '1px solid #d1d5db',
|
|
45
|
+
borderRadius: '6px',
|
|
46
|
+
fontSize: '14px',
|
|
47
|
+
boxSizing: 'border-box',
|
|
48
|
+
} })] }), _jsxs("div", { children: [_jsx("label", { style: { display: 'block', fontSize: '13px', fontWeight: 500, marginBottom: '4px' }, children: "OG Image URL" }), _jsx("input", { type: "url", value: image, onChange: (e) => {
|
|
49
|
+
setImage(e.target.value);
|
|
50
|
+
handleChange('ogImage', e.target.value);
|
|
51
|
+
}, placeholder: "https://example.com/og-image.png", style: {
|
|
52
|
+
width: '100%',
|
|
53
|
+
padding: '8px',
|
|
54
|
+
border: '1px solid #d1d5db',
|
|
55
|
+
borderRadius: '6px',
|
|
56
|
+
fontSize: '14px',
|
|
57
|
+
boxSizing: 'border-box',
|
|
58
|
+
} }), image && (_jsx("div", { style: { marginTop: '8px', borderRadius: '6px', overflow: 'hidden', border: '1px solid #e5e7eb' }, children: _jsx("img", { src: image, alt: "OG Preview", style: { width: '100%', height: 'auto', display: 'block' } }) }))] })] }));
|
|
59
|
+
}
|
|
60
|
+
function CharacterCount({ current, max }) {
|
|
61
|
+
const ratio = current / max;
|
|
62
|
+
const color = ratio > 1 ? '#ef4444' : ratio > 0.9 ? '#f59e0b' : '#6b7280';
|
|
63
|
+
return (_jsxs("div", { style: { fontSize: '12px', color, marginTop: '4px', textAlign: 'right' }, children: [current, "/", max] }));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=SEOPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SEOPanel.js","sourceRoot":"","sources":["../../src/admin/SEOPanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAUxC,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,uDAAuD;AACvD,MAAM,UAAU,QAAQ,CAAC,EACvB,SAAS,GAAG,EAAE,EACd,eAAe,GAAG,EAAE,EACpB,YAAY,GAAG,EAAE,EACjB,OAAO,GAAG,EAAE,EACZ,QAAQ,GACM;IACd,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;IAChE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACzD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAE5C,SAAS,YAAY,CAAC,KAAa,EAAE,KAAa;QAChD,QAAQ,EAAE,CAAC,K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K,EAAE,SAAS,EAAE,OAAO,EAAE,aAC1E,OAAO,OAAG,GAAG,IACV,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface SchemaPreviewProps {
|
|
2
|
+
schema: Record<string, unknown>;
|
|
3
|
+
}
|
|
4
|
+
/** Renders a formatted JSON-LD preview with visual type indicators. */
|
|
5
|
+
export declare function SchemaPreview({ schema }: SchemaPreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=SchemaPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaPreview.d.ts","sourceRoot":"","sources":["../../src/admin/SchemaPreview.tsx"],"names":[],"mappings":"AAIA,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,EAAE,kBAAkB,2CA+D3D"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
/** Renders a formatted JSON-LD preview with visual type indicators. */
|
|
5
|
+
export function SchemaPreview({ schema }) {
|
|
6
|
+
const formatted = useMemo(() => formatJsonLd(schema), [schema]);
|
|
7
|
+
const schemaType = schema['@type'] ?? 'Unknown';
|
|
8
|
+
const isValid = Boolean(schema['@context'] && schema['@type']);
|
|
9
|
+
return (_jsxs("div", { style: { fontFamily: 'system-ui, sans-serif', padding: '16px' }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '12px' }, children: [_jsx("h3", { style: { margin: 0, fontSize: '14px', fontWeight: 600 }, children: "Structured Data Preview" }), _jsx("span", { style: {
|
|
10
|
+
fontSize: '12px',
|
|
11
|
+
padding: '2px 8px',
|
|
12
|
+
borderRadius: '9999px',
|
|
13
|
+
background: isValid ? '#dcfce7' : '#fee2e2',
|
|
14
|
+
color: isValid ? '#166534' : '#991b1b',
|
|
15
|
+
fontWeight: 500,
|
|
16
|
+
}, children: isValid ? 'Valid' : 'Invalid' })] }), _jsxs("div", { style: {
|
|
17
|
+
fontSize: '12px',
|
|
18
|
+
color: '#6b7280',
|
|
19
|
+
marginBottom: '8px',
|
|
20
|
+
}, children: ["Type: ", _jsx("strong", { children: schemaType })] }), _jsx("div", { style: {
|
|
21
|
+
background: '#1e1e1e',
|
|
22
|
+
borderRadius: '8px',
|
|
23
|
+
padding: '16px',
|
|
24
|
+
overflow: 'auto',
|
|
25
|
+
maxHeight: '400px',
|
|
26
|
+
}, children: _jsx("pre", { style: { margin: 0, fontSize: '13px', lineHeight: '20px', color: '#d4d4d4' }, children: _jsx("code", { children: formatted.map((segment, i) => (_jsx("span", { style: { color: segment.color }, children: segment.text }, i))) }) }) }), _jsxs("div", { style: { marginTop: '12px', fontSize: '12px', color: '#9ca3af' }, children: ["Embed as", ' ', _jsx("code", { style: { background: '#f3f4f6', padding: '1px 4px', borderRadius: '3px', fontSize: '11px' }, children: '<script type="application/ld+json">' })] })] }));
|
|
27
|
+
}
|
|
28
|
+
function formatJsonLd(obj, indent = 0) {
|
|
29
|
+
const segments = [];
|
|
30
|
+
const pad = ' '.repeat(indent);
|
|
31
|
+
const innerPad = ' '.repeat(indent + 1);
|
|
32
|
+
if (obj === null || obj === undefined) {
|
|
33
|
+
segments.push({ text: 'null', color: '#569cd6' });
|
|
34
|
+
return segments;
|
|
35
|
+
}
|
|
36
|
+
if (typeof obj === 'string') {
|
|
37
|
+
segments.push({ text: `"${obj}"`, color: '#ce9178' });
|
|
38
|
+
return segments;
|
|
39
|
+
}
|
|
40
|
+
if (typeof obj === 'number' || typeof obj === 'boolean') {
|
|
41
|
+
segments.push({ text: String(obj), color: '#b5cea8' });
|
|
42
|
+
return segments;
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(obj)) {
|
|
45
|
+
if (obj.length === 0) {
|
|
46
|
+
segments.push({ text: '[]', color: '#d4d4d4' });
|
|
47
|
+
return segments;
|
|
48
|
+
}
|
|
49
|
+
segments.push({ text: '[\n', color: '#d4d4d4' });
|
|
50
|
+
obj.forEach((item, i) => {
|
|
51
|
+
segments.push({ text: innerPad, color: '#d4d4d4' });
|
|
52
|
+
segments.push(...formatJsonLd(item, indent + 1));
|
|
53
|
+
if (i < obj.length - 1)
|
|
54
|
+
segments.push({ text: ',', color: '#d4d4d4' });
|
|
55
|
+
segments.push({ text: '\n', color: '#d4d4d4' });
|
|
56
|
+
});
|
|
57
|
+
segments.push({ text: `${pad}]`, color: '#d4d4d4' });
|
|
58
|
+
return segments;
|
|
59
|
+
}
|
|
60
|
+
if (typeof obj === 'object') {
|
|
61
|
+
const entries = Object.entries(obj);
|
|
62
|
+
if (entries.length === 0) {
|
|
63
|
+
segments.push({ text: '{}', color: '#d4d4d4' });
|
|
64
|
+
return segments;
|
|
65
|
+
}
|
|
66
|
+
segments.push({ text: '{\n', color: '#d4d4d4' });
|
|
67
|
+
entries.forEach(([key, value], i) => {
|
|
68
|
+
const keyColor = key.startsWith('@') ? '#c586c0' : '#9cdcfe';
|
|
69
|
+
segments.push({ text: innerPad, color: '#d4d4d4' });
|
|
70
|
+
segments.push({ text: `"${key}"`, color: keyColor });
|
|
71
|
+
segments.push({ text: ': ', color: '#d4d4d4' });
|
|
72
|
+
segments.push(...formatJsonLd(value, indent + 1));
|
|
73
|
+
if (i < entries.length - 1)
|
|
74
|
+
segments.push({ text: ',', color: '#d4d4d4' });
|
|
75
|
+
segments.push({ text: '\n', color: '#d4d4d4' });
|
|
76
|
+
});
|
|
77
|
+
segments.push({ text: `${pad}}`, color: '#d4d4d4' });
|
|
78
|
+
return segments;
|
|
79
|
+
}
|
|
80
|
+
segments.push({ text: String(obj), color: '#d4d4d4' });
|
|
81
|
+
return segments;
|
|
82
|
+
}
|
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AAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YAChD,QAAQ,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC;gBAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YAC3E,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACrD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DuplicateGroup {
|
|
2
|
+
urls: string[];
|
|
3
|
+
similarity: number;
|
|
4
|
+
suggestedCanonical?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Compares pages by content similarity and groups near-duplicates.
|
|
8
|
+
* Uses a simple hash-based similarity metric on normalized text.
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectDuplicates(pages: Array<{
|
|
11
|
+
url: string;
|
|
12
|
+
content: string;
|
|
13
|
+
}>): DuplicateGroup[];
|
|
14
|
+
/** Selects the best canonical URL from a group of duplicates. */
|
|
15
|
+
export declare function suggestCanonical(duplicates: DuplicateGroup): string;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canonical/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7C,cAAc,EAAE,CAmClB;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,CAanE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares pages by content similarity and groups near-duplicates.
|
|
3
|
+
* Uses a simple hash-based similarity metric on normalized text.
|
|
4
|
+
*/
|
|
5
|
+
export function detectDuplicates(pages) {
|
|
6
|
+
const groups = [];
|
|
7
|
+
const assigned = new Set();
|
|
8
|
+
for (let i = 0; i < pages.length; i++) {
|
|
9
|
+
if (assigned.has(i))
|
|
10
|
+
continue;
|
|
11
|
+
const pageI = pages[i];
|
|
12
|
+
const group = [pageI.url];
|
|
13
|
+
let maxSimilarity = 0;
|
|
14
|
+
for (let j = i + 1; j < pages.length; j++) {
|
|
15
|
+
if (assigned.has(j))
|
|
16
|
+
continue;
|
|
17
|
+
const pageJ = pages[j];
|
|
18
|
+
const sim = computeSimilarity(pageI.content, pageJ.content);
|
|
19
|
+
if (sim >= 0.85) {
|
|
20
|
+
group.push(pageJ.url);
|
|
21
|
+
assigned.add(j);
|
|
22
|
+
maxSimilarity = Math.max(maxSimilarity, sim);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (group.length > 1) {
|
|
26
|
+
assigned.add(i);
|
|
27
|
+
const canonical = suggestCanonical({ urls: group, similarity: maxSimilarity });
|
|
28
|
+
groups.push({
|
|
29
|
+
urls: group,
|
|
30
|
+
similarity: maxSimilarity,
|
|
31
|
+
suggestedCanonical: canonical,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return groups;
|
|
36
|
+
}
|
|
37
|
+
/** Selects the best canonical URL from a group of duplicates. */
|
|
38
|
+
export function suggestCanonical(duplicates) {
|
|
39
|
+
const ranked = [...duplicates.urls].sort((a, b) => {
|
|
40
|
+
const depthA = a.split("/").filter(Boolean).length;
|
|
41
|
+
const depthB = b.split("/").filter(Boolean).length;
|
|
42
|
+
if (depthA !== depthB)
|
|
43
|
+
return depthA - depthB;
|
|
44
|
+
if (a.includes("?") && !b.includes("?"))
|
|
45
|
+
return 1;
|
|
46
|
+
if (!a.includes("?") && b.includes("?"))
|
|
47
|
+
return -1;
|
|
48
|
+
return a.length - b.length;
|
|
49
|
+
});
|
|
50
|
+
return ranked[0] ?? "";
|
|
51
|
+
}
|
|
52
|
+
function computeSimilarity(a, b) {
|
|
53
|
+
const tokensA = normalize(a);
|
|
54
|
+
const tokensB = normalize(b);
|
|
55
|
+
if (tokensA.length === 0 && tokensB.length === 0)
|
|
56
|
+
return 1;
|
|
57
|
+
if (tokensA.length === 0 || tokensB.length === 0)
|
|
58
|
+
return 0;
|
|
59
|
+
const setA = new Set(tokensA);
|
|
60
|
+
const setB = new Set(tokensB);
|
|
61
|
+
let intersection = 0;
|
|
62
|
+
for (const token of setA) {
|
|
63
|
+
if (setB.has(token))
|
|
64
|
+
intersection++;
|
|
65
|
+
}
|
|
66
|
+
return (2 * intersection) / (setA.size + setB.size);
|
|
67
|
+
}
|
|
68
|
+
function normalize(content) {
|
|
69
|
+
return content
|
|
70
|
+
.replace(/<[^>]+>/g, " ")
|
|
71
|
+
.replace(/\s+/g, " ")
|
|
72
|
+
.trim()
|
|
73
|
+
.toLowerCase()
|
|
74
|
+
.split(" ")
|
|
75
|
+
.filter((t) => t.length > 2);
|
|
76
|
+
}
|
|
77
|
+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AAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAyC,EAAE,CAAC"}
|
package/dist/fields.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAiHrD,CAAC"}
|
package/dist/fields.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export const seoFields = {
|
|
2
|
+
metaTitle: {
|
|
3
|
+
type: "text",
|
|
4
|
+
label: "Meta Title",
|
|
5
|
+
maxLength: 70,
|
|
6
|
+
admin: {
|
|
7
|
+
position: "sidebar",
|
|
8
|
+
description: "Recommended length: 50–60 characters. Displayed in browser tabs and search results.",
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
metaDescription: {
|
|
12
|
+
type: "text",
|
|
13
|
+
label: "Meta Description",
|
|
14
|
+
maxLength: 160,
|
|
15
|
+
admin: {
|
|
16
|
+
position: "sidebar",
|
|
17
|
+
description: "Recommended length: 120–155 characters. Appears below the title in search results.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
canonicalUrl: {
|
|
21
|
+
type: "url",
|
|
22
|
+
label: "Canonical URL",
|
|
23
|
+
admin: {
|
|
24
|
+
position: "sidebar",
|
|
25
|
+
description: "Set a canonical URL to prevent duplicate content issues. Leave blank to use the page URL.",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
ogImage: {
|
|
29
|
+
type: "media",
|
|
30
|
+
label: "OG Image",
|
|
31
|
+
accept: ["image/png", "image/jpeg", "image/webp"],
|
|
32
|
+
admin: {
|
|
33
|
+
position: "sidebar",
|
|
34
|
+
description: "Recommended size: 1200×630px. Displayed when shared on social platforms.",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
ogTitle: {
|
|
38
|
+
type: "text",
|
|
39
|
+
label: "OG Title",
|
|
40
|
+
maxLength: 70,
|
|
41
|
+
admin: {
|
|
42
|
+
position: "sidebar",
|
|
43
|
+
description: "Overrides the meta title for social sharing. Falls back to Meta Title if empty.",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
ogDescription: {
|
|
47
|
+
type: "text",
|
|
48
|
+
label: "OG Description",
|
|
49
|
+
maxLength: 200,
|
|
50
|
+
admin: {
|
|
51
|
+
position: "sidebar",
|
|
52
|
+
description: "Overrides the meta description for social sharing.",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
twitterCard: {
|
|
56
|
+
type: "select",
|
|
57
|
+
label: "Twitter Card",
|
|
58
|
+
options: [
|
|
59
|
+
{ label: "Summary", value: "summary" },
|
|
60
|
+
{ label: "Summary Large Image", value: "summary_large_image" },
|
|
61
|
+
{ label: "App", value: "app" },
|
|
62
|
+
{ label: "Player", value: "player" },
|
|
63
|
+
],
|
|
64
|
+
admin: {
|
|
65
|
+
position: "sidebar",
|
|
66
|
+
description: "Controls the card style when shared on Twitter/X.",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
robotsNoindex: {
|
|
70
|
+
type: "boolean",
|
|
71
|
+
label: "No Index",
|
|
72
|
+
defaultValue: false,
|
|
73
|
+
admin: {
|
|
74
|
+
position: "sidebar",
|
|
75
|
+
description: "Prevent search engines from indexing this page.",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
robotsNofollow: {
|
|
79
|
+
type: "boolean",
|
|
80
|
+
label: "No Follow",
|
|
81
|
+
defaultValue: false,
|
|
82
|
+
admin: {
|
|
83
|
+
position: "sidebar",
|
|
84
|
+
description: "Prevent search engines from following links on this page.",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
structuredDataType: {
|
|
88
|
+
type: "select",
|
|
89
|
+
label: "Structured Data Type",
|
|
90
|
+
options: [
|
|
91
|
+
{ label: "Article", value: "Article" },
|
|
92
|
+
{ label: "Web Page", value: "WebPage" },
|
|
93
|
+
{ label: "Person", value: "Person" },
|
|
94
|
+
{ label: "Event", value: "Event" },
|
|
95
|
+
{ label: "FAQ Page", value: "FAQPage" },
|
|
96
|
+
{ label: "Service", value: "Service" },
|
|
97
|
+
{ label: "Job Posting", value: "JobPosting" },
|
|
98
|
+
{ label: "Local Business", value: "LocalBusiness" },
|
|
99
|
+
{ label: "Review", value: "Review" },
|
|
100
|
+
{ label: "Product", value: "Product" },
|
|
101
|
+
],
|
|
102
|
+
admin: {
|
|
103
|
+
position: "sidebar",
|
|
104
|
+
description: "Schema.org type for structured data. Auto-detected from collection if not set.",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
structuredDataOverrides: {
|
|
108
|
+
type: "json",
|
|
109
|
+
label: "Structured Data Overrides",
|
|
110
|
+
admin: {
|
|
111
|
+
description: "Manual JSON-LD overrides merged into the auto-generated structured data.",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAoC;IACxD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,YAAY;QACnB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE;YACL,QAAQ,EAAE,SAAS;YACnB,WAAW,EAAE,qFAAqF;SACnG;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,kBAAkB;QACzB,SAAS,EAAE,GAAG;QACd,KAAK,EAAE;YACL,QAAQ,EAAE,SAAS;YACnB,WAAW,EAAE,oFAAoF;SAClG;KACF;IACD,YA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":"AAEA,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD,CA4BA,CAAC"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { detectSchemaType } from "./schema/auto-detect.js";
|
|
2
|
+
export const seoHooks = [
|
|
3
|
+
{
|
|
4
|
+
event: "beforeCreate",
|
|
5
|
+
handler: (...args) => {
|
|
6
|
+
const [data] = args;
|
|
7
|
+
if (!data)
|
|
8
|
+
return;
|
|
9
|
+
const collectionSlug = data._collection ?? "";
|
|
10
|
+
if (!data.structuredDataType && collectionSlug) {
|
|
11
|
+
data.structuredDataType = detectSchemaType(collectionSlug);
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
event: "afterUpdate",
|
|
17
|
+
handler: async (...args) => {
|
|
18
|
+
const [data] = args;
|
|
19
|
+
if (!data)
|
|
20
|
+
return;
|
|
21
|
+
const cacheKey = `sitemap:${data._collection ?? "global"}`;
|
|
22
|
+
if (typeof globalThis !== "undefined") {
|
|
23
|
+
const cache = globalThis.__sitemapCache;
|
|
24
|
+
cache?.delete(cacheKey);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,QAAQ,GAGhB;IACH;QACE,KAAK,EAAE,cAAc;QACrB,OAAO,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE;YAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,IAAiC,CAAC;YACjD,IAAI,CAAC,IAAI;gBAAE,OAAO;YAElB,MAAM,cAAc,GAAI,IAAI,CAAC,WAAsB,IAAI,EAAE,CAAC;YAC1D,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,cAAc,EAAE,CAAC;gBAC/C,IAAI,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;KACF;IACD;QACE,KAAK,EAAE,aAAa;QACpB,OAAO,EAAE,KAAK,EAAE,GAAG,IAAe,EAAE,EAAE;YACpC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAiC,CAAC;YACjD,IAAI,CAAC,IAAI;gBAAE,OAAO;YAElB,MAAM,QAAQ,GAAG,WAAY,IAAI,CAAC,WAAsB,IAAI,QAAQ,EAAE,CAAC;YACvE,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;gBACtC,MAAM,KAAK,GAAI,UAAsC,CAAC,cAEzC,CAAC;gBACd,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;KACF;CACF,CAAC"}
|