@nandansravesh/react-smart-seo 0.1.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/README.md +0 -0
- package/dist/index.cjs +170 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +45 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +142 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
Binary file
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Seo: () => Seo,
|
|
24
|
+
SeoProvider: () => SeoProvider
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// src/seo/SeoProvider.tsx
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var SeoContext = (0, import_react.createContext)(null);
|
|
32
|
+
var SeoProvider = ({ config, children }) => {
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SeoContext.Provider, { value: config, children });
|
|
34
|
+
};
|
|
35
|
+
var useSeoConfig = () => {
|
|
36
|
+
const ctx = (0, import_react.useContext)(SeoContext);
|
|
37
|
+
return ctx != null ? ctx : {};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/seo/validator.ts
|
|
41
|
+
var seenTitles = /* @__PURE__ */ new Set();
|
|
42
|
+
function validateSeo(options, strict) {
|
|
43
|
+
if (process.env.NODE_ENV === "production") return;
|
|
44
|
+
const { title, description, canonical } = options;
|
|
45
|
+
const errors = [];
|
|
46
|
+
if (!title) {
|
|
47
|
+
warn("Missing <title> tag");
|
|
48
|
+
}
|
|
49
|
+
if (description && description.length > 160) {
|
|
50
|
+
warn(
|
|
51
|
+
`Meta description too long (${description.length} chars). Recommended \u2264 160.`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
if (!canonical) {
|
|
55
|
+
warn("Missing canonical URL");
|
|
56
|
+
}
|
|
57
|
+
if (title) {
|
|
58
|
+
if (seenTitles.has(title)) {
|
|
59
|
+
warn(`Duplicate title detected: "${title}"`);
|
|
60
|
+
} else {
|
|
61
|
+
seenTitles.add(title);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (errors.length) {
|
|
65
|
+
if (strict) {
|
|
66
|
+
throw new Error(`[react-smart-seo]
|
|
67
|
+
${errors.join("\n")}`);
|
|
68
|
+
} else {
|
|
69
|
+
errors.forEach(warn);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function warn(message) {
|
|
74
|
+
console.warn(`\u26A0\uFE0F [react-smart-seo] ${message}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/seo/Seo.tsx
|
|
78
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
79
|
+
var Seo = ({
|
|
80
|
+
title,
|
|
81
|
+
description,
|
|
82
|
+
canonical,
|
|
83
|
+
index = true,
|
|
84
|
+
follow = true,
|
|
85
|
+
schema,
|
|
86
|
+
strict = false
|
|
87
|
+
}) => {
|
|
88
|
+
const config = useSeoConfig();
|
|
89
|
+
const resolvedTitle = title ? config.titleTemplate ? config.titleTemplate.replace("%s", title) : title : config.defaultTitle;
|
|
90
|
+
const resolvedDescription = description != null ? description : config.defaultDescription;
|
|
91
|
+
const robots = `${index ? "index" : "noindex"},${follow ? "follow" : "nofollow"}`;
|
|
92
|
+
const autoCanonical = typeof window !== "undefined" ? window.location.pathname : void 0;
|
|
93
|
+
const resolvedCanonical = canonical != null ? canonical : autoCanonical;
|
|
94
|
+
const siteUrl = config.siteUrl;
|
|
95
|
+
const fullUrl = resolvedCanonical && config.siteUrl ? resolvedCanonical.startsWith("http") ? resolvedCanonical : config.siteUrl + resolvedCanonical : resolvedCanonical;
|
|
96
|
+
const ogType = (schema == null ? void 0 : schema.type) === "Article" ? "article" : "website";
|
|
97
|
+
validateSeo(
|
|
98
|
+
{
|
|
99
|
+
title: resolvedTitle,
|
|
100
|
+
description: resolvedDescription,
|
|
101
|
+
canonical: fullUrl
|
|
102
|
+
},
|
|
103
|
+
strict
|
|
104
|
+
);
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
106
|
+
resolvedTitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("title", { children: resolvedTitle }),
|
|
107
|
+
resolvedDescription && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { name: "description", content: resolvedDescription }),
|
|
108
|
+
fullUrl && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("link", { rel: "canonical", href: fullUrl }),
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { name: "robots", content: robots }),
|
|
110
|
+
resolvedTitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { property: "og:title", content: resolvedTitle }),
|
|
111
|
+
resolvedDescription && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { property: "og:description", content: resolvedDescription }),
|
|
112
|
+
fullUrl && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { property: "og:url", content: fullUrl }),
|
|
113
|
+
config.siteName && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { property: "og:site_name", content: config.siteName }),
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { property: "og:type", content: ogType }),
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { name: "twitter:card", content: "summary_large_image" }),
|
|
116
|
+
config.twitterHandle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { name: "twitter:site", content: config.twitterHandle }),
|
|
117
|
+
resolvedTitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { name: "twitter:title", content: resolvedTitle }),
|
|
118
|
+
resolvedDescription && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("meta", { name: "twitter:description", content: resolvedDescription }),
|
|
119
|
+
schema && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
120
|
+
"script",
|
|
121
|
+
{
|
|
122
|
+
type: "application/ld+json",
|
|
123
|
+
dangerouslySetInnerHTML: {
|
|
124
|
+
__html: JSON.stringify(buildJsonLd(schema))
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] });
|
|
129
|
+
};
|
|
130
|
+
function buildJsonLd(schema) {
|
|
131
|
+
switch (schema.type) {
|
|
132
|
+
case "WebSite":
|
|
133
|
+
return {
|
|
134
|
+
"@context": "https://schema.org",
|
|
135
|
+
"@type": "WebSite",
|
|
136
|
+
name: schema.name,
|
|
137
|
+
url: schema.url
|
|
138
|
+
};
|
|
139
|
+
case "Article":
|
|
140
|
+
return {
|
|
141
|
+
"@context": "https://schema.org",
|
|
142
|
+
"@type": "Article",
|
|
143
|
+
headline: schema.headline,
|
|
144
|
+
datePublished: schema.datePublished,
|
|
145
|
+
author: {
|
|
146
|
+
"@type": "Person",
|
|
147
|
+
name: schema.author
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
case "Breadcrumb":
|
|
151
|
+
return {
|
|
152
|
+
"@context": "https://schema.org",
|
|
153
|
+
"@type": "BreadcrumbList",
|
|
154
|
+
itemListElement: schema.items.map((item, index) => ({
|
|
155
|
+
"@type": "ListItem",
|
|
156
|
+
position: index + 1,
|
|
157
|
+
name: item.name,
|
|
158
|
+
item: item.url
|
|
159
|
+
}))
|
|
160
|
+
};
|
|
161
|
+
default:
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
166
|
+
0 && (module.exports = {
|
|
167
|
+
Seo,
|
|
168
|
+
SeoProvider
|
|
169
|
+
});
|
|
170
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/seo/SeoProvider.tsx","../src/seo/validator.ts","../src/seo/Seo.tsx"],"sourcesContent":["// Public exports\r\n\r\nexport { Seo } from \"./seo/Seo\";\r\nexport { SeoProvider } from \"./seo/SeoProvider\";\r\n\r\n// Types (explicit exports for DX)\r\nexport type { SeoProps, SeoConfig, SeoSchema } from \"./types\";\r\n","import React, { createContext, useContext } from \"react\";\r\nimport type { SeoConfig } from \"../types\";\r\n\r\nconst SeoContext = createContext<SeoConfig | null>(null);\r\n\r\nexport const SeoProvider: React.FC<{\r\n config: SeoConfig;\r\n children: React.ReactNode;\r\n}> = ({ config, children }) => {\r\n return <SeoContext.Provider value={config}>{children}</SeoContext.Provider>;\r\n};\r\n\r\n/* ================================\r\n Internal Hook (Not Exported)\r\n================================ */\r\n\r\nexport const useSeoConfig = (): SeoConfig => {\r\n const ctx = useContext(SeoContext);\r\n return ctx ?? {};\r\n};\r\n","const seenTitles = new Set<string>();\r\n\r\nexport function validateSeo(\r\n options: {\r\n title?: string;\r\n description?: string;\r\n canonical?: string;\r\n },\r\n strict?: boolean\r\n) {\r\n if (process.env.NODE_ENV === \"production\") return;\r\n\r\n const { title, description, canonical } = options;\r\n const errors: string[] = [];\r\n\r\n if (!title) {\r\n warn(\"Missing <title> tag\");\r\n }\r\n\r\n if (description && description.length > 160) {\r\n warn(\r\n `Meta description too long (${description.length} chars). Recommended ≤ 160.`\r\n );\r\n }\r\n\r\n if (!canonical) {\r\n warn(\"Missing canonical URL\");\r\n }\r\n\r\n if (title) {\r\n if (seenTitles.has(title)) {\r\n warn(`Duplicate title detected: \"${title}\"`);\r\n } else {\r\n seenTitles.add(title);\r\n }\r\n }\r\n\r\n if (errors.length) {\r\n if (strict) {\r\n throw new Error(`[react-smart-seo]\\n${errors.join(\"\\n\")}`);\r\n } else {\r\n errors.forEach(warn);\r\n }\r\n }\r\n}\r\n\r\nfunction warn(message: string) {\r\n console.warn(`⚠️ [react-smart-seo] ${message}`);\r\n}\r\n","import React from \"react\";\r\nimport { useSeoConfig } from \"./SeoProvider\";\r\nimport type { SeoProps } from \"../types\";\r\nimport { validateSeo } from \"./validator\";\r\n\r\nexport const Seo: React.FC<SeoProps> = ({\r\n title,\r\n description,\r\n canonical,\r\n index = true,\r\n follow = true,\r\n schema,\r\n strict = false,\r\n}) => {\r\n const config = useSeoConfig();\r\n\r\n const resolvedTitle = title\r\n ? config.titleTemplate\r\n ? config.titleTemplate.replace(\"%s\", title)\r\n : title\r\n : config.defaultTitle;\r\n\r\n const resolvedDescription = description ?? config.defaultDescription;\r\n\r\n const robots = `${index ? \"index\" : \"noindex\"},${\r\n follow ? \"follow\" : \"nofollow\"\r\n }`;\r\n\r\n // Canonical URL resolution\r\n const autoCanonical =\r\n typeof window !== \"undefined\" ? window.location.pathname : undefined;\r\n\r\n const resolvedCanonical = canonical ?? autoCanonical;\r\n\r\n // Open Graph Type resolution\r\n const siteUrl = config.siteUrl;\r\n const fullUrl =\r\n resolvedCanonical && config.siteUrl\r\n ? resolvedCanonical.startsWith(\"http\")\r\n ? resolvedCanonical\r\n : config.siteUrl + resolvedCanonical\r\n : resolvedCanonical;\r\n\r\n const ogType = schema?.type === \"Article\" ? \"article\" : \"website\";\r\n\r\n // Validate SEO props\r\n validateSeo(\r\n {\r\n title: resolvedTitle,\r\n description: resolvedDescription,\r\n canonical: fullUrl,\r\n },\r\n strict\r\n );\r\n\r\n return (\r\n <>\r\n {resolvedTitle && <title>{resolvedTitle}</title>}\r\n\r\n {resolvedDescription && (\r\n <meta name=\"description\" content={resolvedDescription} />\r\n )}\r\n\r\n {fullUrl && <link rel=\"canonical\" href={fullUrl} />}\r\n\r\n <meta name=\"robots\" content={robots} />\r\n\r\n {/* ---------- Open Graph ---------- */}\r\n {resolvedTitle && <meta property=\"og:title\" content={resolvedTitle} />}\r\n {resolvedDescription && (\r\n <meta property=\"og:description\" content={resolvedDescription} />\r\n )}\r\n {fullUrl && <meta property=\"og:url\" content={fullUrl} />}\r\n {config.siteName && (\r\n <meta property=\"og:site_name\" content={config.siteName} />\r\n )}\r\n <meta property=\"og:type\" content={ogType} />\r\n\r\n {/* ---------- Twitter ---------- */}\r\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\r\n {config.twitterHandle && (\r\n <meta name=\"twitter:site\" content={config.twitterHandle} />\r\n )}\r\n {resolvedTitle && <meta name=\"twitter:title\" content={resolvedTitle} />}\r\n {resolvedDescription && (\r\n <meta name=\"twitter:description\" content={resolvedDescription} />\r\n )}\r\n\r\n {/* ---------- Structured Data ---------- */}\r\n {schema && (\r\n <script\r\n type=\"application/ld+json\"\r\n dangerouslySetInnerHTML={{\r\n __html: JSON.stringify(buildJsonLd(schema)),\r\n }}\r\n />\r\n )}\r\n </>\r\n );\r\n};\r\n\r\n/* ================================\r\n Helpers\r\n================================ */\r\n\r\nfunction buildJsonLd(schema: any) {\r\n switch (schema.type) {\r\n case \"WebSite\":\r\n return {\r\n \"@context\": \"https://schema.org\",\r\n \"@type\": \"WebSite\",\r\n name: schema.name,\r\n url: schema.url,\r\n };\r\n\r\n case \"Article\":\r\n return {\r\n \"@context\": \"https://schema.org\",\r\n \"@type\": \"Article\",\r\n headline: schema.headline,\r\n datePublished: schema.datePublished,\r\n author: {\r\n \"@type\": \"Person\",\r\n name: schema.author,\r\n },\r\n };\r\n\r\n case \"Breadcrumb\":\r\n return {\r\n \"@context\": \"https://schema.org\",\r\n \"@type\": \"BreadcrumbList\",\r\n itemListElement: schema.items.map((item: any, index: number) => ({\r\n \"@type\": \"ListItem\",\r\n position: index + 1,\r\n name: item.name,\r\n item: item.url,\r\n })),\r\n };\r\n\r\n default:\r\n return null;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAiD;AASxC;AANT,IAAM,iBAAa,4BAAgC,IAAI;AAEhD,IAAM,cAGR,CAAC,EAAE,QAAQ,SAAS,MAAM;AAC7B,SAAO,4CAAC,WAAW,UAAX,EAAoB,OAAO,QAAS,UAAS;AACvD;AAMO,IAAM,eAAe,MAAiB;AAC3C,QAAM,UAAM,yBAAW,UAAU;AACjC,SAAO,oBAAO,CAAC;AACjB;;;ACnBA,IAAM,aAAa,oBAAI,IAAY;AAE5B,SAAS,YACd,SAKA,QACA;AACA,MAAI,QAAQ,IAAI,aAAa,aAAc;AAE3C,QAAM,EAAE,OAAO,aAAa,UAAU,IAAI;AAC1C,QAAM,SAAmB,CAAC;AAE1B,MAAI,CAAC,OAAO;AACV,SAAK,qBAAqB;AAAA,EAC5B;AAEA,MAAI,eAAe,YAAY,SAAS,KAAK;AAC3C;AAAA,MACE,8BAA8B,YAAY,MAAM;AAAA,IAClD;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,SAAK,uBAAuB;AAAA,EAC9B;AAEA,MAAI,OAAO;AACT,QAAI,WAAW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AAO,MAAM,IAAI,CAAC,MAAW,WAAmB;AAAA,UAC/D,SAAS;AAAA,UACT,UAAU,QAAQ;AAAA,UAClB,MAAM,KAAK;AAAA,UACX,MAAM,KAAK;AAAA,QACb,EAAE;AAAA,MACJ;AAAA,IAEF;AACE,aAAO;AAAA,EACX;AACF;","names":["import_jsx_runtime"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface SeoConfig {
|
|
4
|
+
siteName?: string;
|
|
5
|
+
siteUrl?: string;
|
|
6
|
+
titleTemplate?: string;
|
|
7
|
+
defaultTitle?: string;
|
|
8
|
+
defaultDescription?: string;
|
|
9
|
+
twitterHandle?: string;
|
|
10
|
+
}
|
|
11
|
+
type SeoSchema = {
|
|
12
|
+
type: "WebSite";
|
|
13
|
+
name: string;
|
|
14
|
+
url: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "Article";
|
|
17
|
+
headline: string;
|
|
18
|
+
datePublished: string;
|
|
19
|
+
author: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "Breadcrumb";
|
|
22
|
+
items: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
url: string;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
interface SeoProps {
|
|
28
|
+
title?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
canonical?: string;
|
|
31
|
+
index?: boolean;
|
|
32
|
+
follow?: boolean;
|
|
33
|
+
schema?: SeoSchema;
|
|
34
|
+
ogType?: "website" | "article";
|
|
35
|
+
strict?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const Seo: React.FC<SeoProps>;
|
|
39
|
+
|
|
40
|
+
declare const SeoProvider: React.FC<{
|
|
41
|
+
config: SeoConfig;
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
}>;
|
|
44
|
+
|
|
45
|
+
export { Seo, type SeoConfig, type SeoProps, SeoProvider, type SeoSchema };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface SeoConfig {
|
|
4
|
+
siteName?: string;
|
|
5
|
+
siteUrl?: string;
|
|
6
|
+
titleTemplate?: string;
|
|
7
|
+
defaultTitle?: string;
|
|
8
|
+
defaultDescription?: string;
|
|
9
|
+
twitterHandle?: string;
|
|
10
|
+
}
|
|
11
|
+
type SeoSchema = {
|
|
12
|
+
type: "WebSite";
|
|
13
|
+
name: string;
|
|
14
|
+
url: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "Article";
|
|
17
|
+
headline: string;
|
|
18
|
+
datePublished: string;
|
|
19
|
+
author: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "Breadcrumb";
|
|
22
|
+
items: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
url: string;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
interface SeoProps {
|
|
28
|
+
title?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
canonical?: string;
|
|
31
|
+
index?: boolean;
|
|
32
|
+
follow?: boolean;
|
|
33
|
+
schema?: SeoSchema;
|
|
34
|
+
ogType?: "website" | "article";
|
|
35
|
+
strict?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const Seo: React.FC<SeoProps>;
|
|
39
|
+
|
|
40
|
+
declare const SeoProvider: React.FC<{
|
|
41
|
+
config: SeoConfig;
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
}>;
|
|
44
|
+
|
|
45
|
+
export { Seo, type SeoConfig, type SeoProps, SeoProvider, type SeoSchema };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// src/seo/SeoProvider.tsx
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var SeoContext = createContext(null);
|
|
5
|
+
var SeoProvider = ({ config, children }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(SeoContext.Provider, { value: config, children });
|
|
7
|
+
};
|
|
8
|
+
var useSeoConfig = () => {
|
|
9
|
+
const ctx = useContext(SeoContext);
|
|
10
|
+
return ctx != null ? ctx : {};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/seo/validator.ts
|
|
14
|
+
var seenTitles = /* @__PURE__ */ new Set();
|
|
15
|
+
function validateSeo(options, strict) {
|
|
16
|
+
if (process.env.NODE_ENV === "production") return;
|
|
17
|
+
const { title, description, canonical } = options;
|
|
18
|
+
const errors = [];
|
|
19
|
+
if (!title) {
|
|
20
|
+
warn("Missing <title> tag");
|
|
21
|
+
}
|
|
22
|
+
if (description && description.length > 160) {
|
|
23
|
+
warn(
|
|
24
|
+
`Meta description too long (${description.length} chars). Recommended \u2264 160.`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
if (!canonical) {
|
|
28
|
+
warn("Missing canonical URL");
|
|
29
|
+
}
|
|
30
|
+
if (title) {
|
|
31
|
+
if (seenTitles.has(title)) {
|
|
32
|
+
warn(`Duplicate title detected: "${title}"`);
|
|
33
|
+
} else {
|
|
34
|
+
seenTitles.add(title);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (errors.length) {
|
|
38
|
+
if (strict) {
|
|
39
|
+
throw new Error(`[react-smart-seo]
|
|
40
|
+
${errors.join("\n")}`);
|
|
41
|
+
} else {
|
|
42
|
+
errors.forEach(warn);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function warn(message) {
|
|
47
|
+
console.warn(`\u26A0\uFE0F [react-smart-seo] ${message}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/seo/Seo.tsx
|
|
51
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
52
|
+
var Seo = ({
|
|
53
|
+
title,
|
|
54
|
+
description,
|
|
55
|
+
canonical,
|
|
56
|
+
index = true,
|
|
57
|
+
follow = true,
|
|
58
|
+
schema,
|
|
59
|
+
strict = false
|
|
60
|
+
}) => {
|
|
61
|
+
const config = useSeoConfig();
|
|
62
|
+
const resolvedTitle = title ? config.titleTemplate ? config.titleTemplate.replace("%s", title) : title : config.defaultTitle;
|
|
63
|
+
const resolvedDescription = description != null ? description : config.defaultDescription;
|
|
64
|
+
const robots = `${index ? "index" : "noindex"},${follow ? "follow" : "nofollow"}`;
|
|
65
|
+
const autoCanonical = typeof window !== "undefined" ? window.location.pathname : void 0;
|
|
66
|
+
const resolvedCanonical = canonical != null ? canonical : autoCanonical;
|
|
67
|
+
const siteUrl = config.siteUrl;
|
|
68
|
+
const fullUrl = resolvedCanonical && config.siteUrl ? resolvedCanonical.startsWith("http") ? resolvedCanonical : config.siteUrl + resolvedCanonical : resolvedCanonical;
|
|
69
|
+
const ogType = (schema == null ? void 0 : schema.type) === "Article" ? "article" : "website";
|
|
70
|
+
validateSeo(
|
|
71
|
+
{
|
|
72
|
+
title: resolvedTitle,
|
|
73
|
+
description: resolvedDescription,
|
|
74
|
+
canonical: fullUrl
|
|
75
|
+
},
|
|
76
|
+
strict
|
|
77
|
+
);
|
|
78
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79
|
+
resolvedTitle && /* @__PURE__ */ jsx2("title", { children: resolvedTitle }),
|
|
80
|
+
resolvedDescription && /* @__PURE__ */ jsx2("meta", { name: "description", content: resolvedDescription }),
|
|
81
|
+
fullUrl && /* @__PURE__ */ jsx2("link", { rel: "canonical", href: fullUrl }),
|
|
82
|
+
/* @__PURE__ */ jsx2("meta", { name: "robots", content: robots }),
|
|
83
|
+
resolvedTitle && /* @__PURE__ */ jsx2("meta", { property: "og:title", content: resolvedTitle }),
|
|
84
|
+
resolvedDescription && /* @__PURE__ */ jsx2("meta", { property: "og:description", content: resolvedDescription }),
|
|
85
|
+
fullUrl && /* @__PURE__ */ jsx2("meta", { property: "og:url", content: fullUrl }),
|
|
86
|
+
config.siteName && /* @__PURE__ */ jsx2("meta", { property: "og:site_name", content: config.siteName }),
|
|
87
|
+
/* @__PURE__ */ jsx2("meta", { property: "og:type", content: ogType }),
|
|
88
|
+
/* @__PURE__ */ jsx2("meta", { name: "twitter:card", content: "summary_large_image" }),
|
|
89
|
+
config.twitterHandle && /* @__PURE__ */ jsx2("meta", { name: "twitter:site", content: config.twitterHandle }),
|
|
90
|
+
resolvedTitle && /* @__PURE__ */ jsx2("meta", { name: "twitter:title", content: resolvedTitle }),
|
|
91
|
+
resolvedDescription && /* @__PURE__ */ jsx2("meta", { name: "twitter:description", content: resolvedDescription }),
|
|
92
|
+
schema && /* @__PURE__ */ jsx2(
|
|
93
|
+
"script",
|
|
94
|
+
{
|
|
95
|
+
type: "application/ld+json",
|
|
96
|
+
dangerouslySetInnerHTML: {
|
|
97
|
+
__html: JSON.stringify(buildJsonLd(schema))
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] });
|
|
102
|
+
};
|
|
103
|
+
function buildJsonLd(schema) {
|
|
104
|
+
switch (schema.type) {
|
|
105
|
+
case "WebSite":
|
|
106
|
+
return {
|
|
107
|
+
"@context": "https://schema.org",
|
|
108
|
+
"@type": "WebSite",
|
|
109
|
+
name: schema.name,
|
|
110
|
+
url: schema.url
|
|
111
|
+
};
|
|
112
|
+
case "Article":
|
|
113
|
+
return {
|
|
114
|
+
"@context": "https://schema.org",
|
|
115
|
+
"@type": "Article",
|
|
116
|
+
headline: schema.headline,
|
|
117
|
+
datePublished: schema.datePublished,
|
|
118
|
+
author: {
|
|
119
|
+
"@type": "Person",
|
|
120
|
+
name: schema.author
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
case "Breadcrumb":
|
|
124
|
+
return {
|
|
125
|
+
"@context": "https://schema.org",
|
|
126
|
+
"@type": "BreadcrumbList",
|
|
127
|
+
itemListElement: schema.items.map((item, index) => ({
|
|
128
|
+
"@type": "ListItem",
|
|
129
|
+
position: index + 1,
|
|
130
|
+
name: item.name,
|
|
131
|
+
item: item.url
|
|
132
|
+
}))
|
|
133
|
+
};
|
|
134
|
+
default:
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
Seo,
|
|
140
|
+
SeoProvider
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/seo/SeoProvider.tsx","../src/seo/validator.ts","../src/seo/Seo.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\r\nimport type { SeoConfig } from \"../types\";\r\n\r\nconst SeoContext = createContext<SeoConfig | null>(null);\r\n\r\nexport const SeoProvider: React.FC<{\r\n config: SeoConfig;\r\n children: React.ReactNode;\r\n}> = ({ config, children }) => {\r\n return <SeoContext.Provider value={config}>{children}</SeoContext.Provider>;\r\n};\r\n\r\n/* ================================\r\n Internal Hook (Not Exported)\r\n================================ */\r\n\r\nexport const useSeoConfig = (): SeoConfig => {\r\n const ctx = useContext(SeoContext);\r\n return ctx ?? {};\r\n};\r\n","const seenTitles = new Set<string>();\r\n\r\nexport function validateSeo(\r\n options: {\r\n title?: string;\r\n description?: string;\r\n canonical?: string;\r\n },\r\n strict?: boolean\r\n) {\r\n if (process.env.NODE_ENV === \"production\") return;\r\n\r\n const { title, description, canonical } = options;\r\n const errors: string[] = [];\r\n\r\n if (!title) {\r\n warn(\"Missing <title> tag\");\r\n }\r\n\r\n if (description && description.length > 160) {\r\n warn(\r\n `Meta description too long (${description.length} chars). Recommended ≤ 160.`\r\n );\r\n }\r\n\r\n if (!canonical) {\r\n warn(\"Missing canonical URL\");\r\n }\r\n\r\n if (title) {\r\n if (seenTitles.has(title)) {\r\n warn(`Duplicate title detected: \"${title}\"`);\r\n } else {\r\n seenTitles.add(title);\r\n }\r\n }\r\n\r\n if (errors.length) {\r\n if (strict) {\r\n throw new Error(`[react-smart-seo]\\n${errors.join(\"\\n\")}`);\r\n } else {\r\n errors.forEach(warn);\r\n }\r\n }\r\n}\r\n\r\nfunction warn(message: string) {\r\n console.warn(`⚠️ [react-smart-seo] ${message}`);\r\n}\r\n","import React from \"react\";\r\nimport { useSeoConfig } from \"./SeoProvider\";\r\nimport type { SeoProps } from \"../types\";\r\nimport { validateSeo } from \"./validator\";\r\n\r\nexport const Seo: React.FC<SeoProps> = ({\r\n title,\r\n description,\r\n canonical,\r\n index = true,\r\n follow = true,\r\n schema,\r\n strict = false,\r\n}) => {\r\n const config = useSeoConfig();\r\n\r\n const resolvedTitle = title\r\n ? config.titleTemplate\r\n ? config.titleTemplate.replace(\"%s\", title)\r\n : title\r\n : config.defaultTitle;\r\n\r\n const resolvedDescription = description ?? config.defaultDescription;\r\n\r\n const robots = `${index ? \"index\" : \"noindex\"},${\r\n follow ? \"follow\" : \"nofollow\"\r\n }`;\r\n\r\n // Canonical URL resolution\r\n const autoCanonical =\r\n typeof window !== \"undefined\" ? window.location.pathname : undefined;\r\n\r\n const resolvedCanonical = canonical ?? autoCanonical;\r\n\r\n // Open Graph Type resolution\r\n const siteUrl = config.siteUrl;\r\n const fullUrl =\r\n resolvedCanonical && config.siteUrl\r\n ? resolvedCanonical.startsWith(\"http\")\r\n ? resolvedCanonical\r\n : config.siteUrl + resolvedCanonical\r\n : resolvedCanonical;\r\n\r\n const ogType = schema?.type === \"Article\" ? \"article\" : \"website\";\r\n\r\n // Validate SEO props\r\n validateSeo(\r\n {\r\n title: resolvedTitle,\r\n description: resolvedDescription,\r\n canonical: fullUrl,\r\n },\r\n strict\r\n );\r\n\r\n return (\r\n <>\r\n {resolvedTitle && <title>{resolvedTitle}</title>}\r\n\r\n {resolvedDescription && (\r\n <meta name=\"description\" content={resolvedDescription} />\r\n )}\r\n\r\n {fullUrl && <link rel=\"canonical\" href={fullUrl} />}\r\n\r\n <meta name=\"robots\" content={robots} />\r\n\r\n {/* ---------- Open Graph ---------- */}\r\n {resolvedTitle && <meta property=\"og:title\" content={resolvedTitle} />}\r\n {resolvedDescription && (\r\n <meta property=\"og:description\" content={resolvedDescription} />\r\n )}\r\n {fullUrl && <meta property=\"og:url\" content={fullUrl} />}\r\n {config.siteName && (\r\n <meta property=\"og:site_name\" content={config.siteName} />\r\n )}\r\n <meta property=\"og:type\" content={ogType} />\r\n\r\n {/* ---------- Twitter ---------- */}\r\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\r\n {config.twitterHandle && (\r\n <meta name=\"twitter:site\" content={config.twitterHandle} />\r\n )}\r\n {resolvedTitle && <meta name=\"twitter:title\" content={resolvedTitle} />}\r\n {resolvedDescription && (\r\n <meta name=\"twitter:description\" content={resolvedDescription} />\r\n )}\r\n\r\n {/* ---------- Structured Data ---------- */}\r\n {schema && (\r\n <script\r\n type=\"application/ld+json\"\r\n dangerouslySetInnerHTML={{\r\n __html: JSON.stringify(buildJsonLd(schema)),\r\n }}\r\n />\r\n )}\r\n </>\r\n );\r\n};\r\n\r\n/* ================================\r\n Helpers\r\n================================ */\r\n\r\nfunction buildJsonLd(schema: any) {\r\n switch (schema.type) {\r\n case \"WebSite\":\r\n return {\r\n \"@context\": \"https://schema.org\",\r\n \"@type\": \"WebSite\",\r\n name: schema.name,\r\n url: schema.url,\r\n };\r\n\r\n case \"Article\":\r\n return {\r\n \"@context\": \"https://schema.org\",\r\n \"@type\": \"Article\",\r\n headline: schema.headline,\r\n datePublished: schema.datePublished,\r\n author: {\r\n \"@type\": \"Person\",\r\n name: schema.author,\r\n },\r\n };\r\n\r\n case \"Breadcrumb\":\r\n return {\r\n \"@context\": \"https://schema.org\",\r\n \"@type\": \"BreadcrumbList\",\r\n itemListElement: schema.items.map((item: any, index: number) => ({\r\n \"@type\": \"ListItem\",\r\n position: index + 1,\r\n name: item.name,\r\n item: item.url,\r\n })),\r\n };\r\n\r\n default:\r\n return null;\r\n }\r\n}\r\n"],"mappings":";AAAA,SAAgB,eAAe,kBAAkB;AASxC;AANT,IAAM,aAAa,cAAgC,IAAI;AAEhD,IAAM,cAGR,CAAC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S,eAAe;AAAA,IACpE,uBACC,gBAAAA,KAAC,UAAK,MAAK,uBAAsB,SAAS,qBAAqB;AAAA,IAIhE,UACC,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,yBAAyB;AAAA,UACvB,QAAQ,KAAK,UAAU,YAAY,MAAM,CAAC;AAAA,QAC5C;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;AAMA,SAAS,YAAY,QAAa;AAChC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AACH,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,MAAM,OAAO;AAAA,QACb,KAAK,OAAO;AAAA,MACd;AAAA,IAEF,KAAK;AACH,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,UAAU,OAAO;AAAA,QACjB,eAAe,OAAO;AAAA,QACtB,QAAQ;AAAA,UACN,SAAS;AAAA,UACT,MAAM,OAAO;AAAA,QACf;AAAA,MACF;AAAA,IAEF,KAAK;AACH,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,iBAAiB,OAAO,MAAM,IAAI,CAAC,MAAW,WAAmB;AAAA,UAC/D,SAAS;AAAA,UACT,UAAU,QAAQ;AAAA,UAClB,MAAM,KAAK;AAAA,UACX,MAAM,KAAK;AAAA,QACb,EAAE;AAAA,MACJ;AAAA,IAEF;AACE,aAAO;AAAA,EACX;AACF;","names":["jsx"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nandansravesh/react-smart-seo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"description": "Framework-agnostic SEO orchestration for React with automatic metadata, Open Graph, and structured data.",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"react",
|
|
11
|
+
"seo",
|
|
12
|
+
"react-seo",
|
|
13
|
+
"metadata",
|
|
14
|
+
"open-graph",
|
|
15
|
+
"twitter-cards",
|
|
16
|
+
"json-ld",
|
|
17
|
+
"head",
|
|
18
|
+
"ssr"
|
|
19
|
+
],
|
|
20
|
+
"author": "Sravesh Nandan",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.cjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/sraveshnandan/react-smart-seo"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/sraveshnandan/react-smart-seo",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/sraveshnandan/react-smart-seo/issues"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": ">=17"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^25.0.3",
|
|
48
|
+
"@types/react": "^19.2.7",
|
|
49
|
+
"react": "^19.2.3",
|
|
50
|
+
"react-dom": "^19.2.3",
|
|
51
|
+
"tsup": "^8.5.1",
|
|
52
|
+
"typescript": "^5.9.3"
|
|
53
|
+
}
|
|
54
|
+
}
|