dn-react-router-toolkit 0.1.6 → 0.1.8
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/seo-kit/seo.d.mts +19 -51
- package/dist/seo-kit/seo.d.ts +19 -51
- package/dist/seo-kit/seo.js +246 -238
- package/dist/seo-kit/seo.mjs +246 -238
- package/package.json +1 -1
- package/dist/seo-kit/index.d.mts +0 -6
- package/dist/seo-kit/index.d.ts +0 -6
- package/dist/seo-kit/index.js +0 -321
- package/dist/seo-kit/index.mjs +0 -282
- package/dist/seo-kit/loader.d.mts +0 -7
- package/dist/seo-kit/loader.d.ts +0 -7
- package/dist/seo-kit/loader.js +0 -43
- package/dist/seo-kit/loader.mjs +0 -18
- package/dist/seo-kit/seo_loader.d.mts +0 -16
- package/dist/seo-kit/seo_loader.d.ts +0 -16
- package/dist/seo-kit/seo_loader.js +0 -68
- package/dist/seo-kit/seo_loader.mjs +0 -31
package/dist/seo-kit/seo.js
CHANGED
|
@@ -34,250 +34,258 @@ __export(seo_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(seo_exports);
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_react_router = require("react-router");
|
|
37
38
|
function configSEO(config) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
function init(props) {
|
|
40
|
+
const canonicalPath = props.canonicalPath;
|
|
41
|
+
const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
|
|
42
|
+
const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
|
|
43
|
+
const description = props.description || config.description;
|
|
44
|
+
const keywords = props.keywords || config.keywords;
|
|
45
|
+
const thumbnail = props.thumbnail || (typeof config.thumbnail === "function" ? config.thumbnail() : config.thumbnail);
|
|
46
|
+
return {
|
|
47
|
+
pageTitle,
|
|
48
|
+
type: props.type,
|
|
49
|
+
description,
|
|
50
|
+
keywords,
|
|
51
|
+
url,
|
|
52
|
+
thumbnail
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const meta = ({ loaderData }) => {
|
|
56
|
+
const props = loaderData?.seo || {};
|
|
57
|
+
const { pageTitle, type, description, keywords, url, thumbnail } = props;
|
|
58
|
+
const socialImage = thumbnail ? [
|
|
59
|
+
typeof thumbnail === "string" ? {
|
|
60
|
+
url: thumbnail,
|
|
61
|
+
alt: `${props.title} \uB300\uD45C \uC774\uBBF8\uC9C0`
|
|
62
|
+
} : thumbnail
|
|
63
|
+
] : [];
|
|
64
|
+
return [
|
|
65
|
+
pageTitle && { title: pageTitle },
|
|
66
|
+
description && { name: "description", content: description },
|
|
67
|
+
keywords && { name: "keywords", content: keywords.join(", ") },
|
|
68
|
+
url && {
|
|
69
|
+
tagName: "link",
|
|
70
|
+
rel: "canonical",
|
|
71
|
+
href: url
|
|
72
|
+
},
|
|
73
|
+
{ property: "og:type", content: type || "website" },
|
|
74
|
+
pageTitle && { property: "og:title", content: pageTitle },
|
|
75
|
+
description && { property: "og:description", content: description },
|
|
76
|
+
url && { property: "og:url", content: url },
|
|
77
|
+
{ property: "og:site_name", content: config.siteName },
|
|
78
|
+
...socialImage?.map((file) => ({
|
|
79
|
+
property: "og:image",
|
|
80
|
+
content: file.url
|
|
81
|
+
})),
|
|
82
|
+
{
|
|
83
|
+
property: "twitter:card",
|
|
84
|
+
content: socialImage.length > 0 ? "summary_large_image" : "summary"
|
|
85
|
+
},
|
|
86
|
+
pageTitle && { property: "twitter:title", content: pageTitle },
|
|
87
|
+
description && { property: "twitter:description", content: description },
|
|
88
|
+
...socialImage?.map((file) => ({
|
|
89
|
+
property: "twitter:image",
|
|
90
|
+
content: file.url
|
|
91
|
+
}))
|
|
92
|
+
];
|
|
93
|
+
};
|
|
94
|
+
function StructedData() {
|
|
95
|
+
const matches = (0, import_react_router.useMatches)();
|
|
96
|
+
const data = matches.reduce((acc, match) => {
|
|
97
|
+
return {
|
|
98
|
+
...acc,
|
|
99
|
+
...match.loaderData?.seo || {}
|
|
55
100
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
101
|
+
}, {});
|
|
102
|
+
const { pageTitle, description, keywords, url, thumbnail } = data;
|
|
103
|
+
const thumbnailUrl = thumbnail?.url;
|
|
104
|
+
const props = data?.seo || {};
|
|
105
|
+
const websiteSchemaId = `${config.origin}/#website`;
|
|
106
|
+
const websiteSchema = {
|
|
107
|
+
"@type": "WebSite",
|
|
108
|
+
"@id": websiteSchemaId,
|
|
109
|
+
url: config.origin,
|
|
110
|
+
name: config.siteName,
|
|
111
|
+
alternateName: config.siteName,
|
|
112
|
+
description: config.description,
|
|
113
|
+
inLanguage: "ko"
|
|
114
|
+
};
|
|
115
|
+
const thumbnailSchemaId = `${url}/#thumbnail`;
|
|
116
|
+
const images = [
|
|
117
|
+
...thumbnailUrl ? [
|
|
118
|
+
{
|
|
119
|
+
id: thumbnailSchemaId,
|
|
120
|
+
url: thumbnailUrl,
|
|
62
121
|
alt: `${props.title} \uB300\uD45C \uC774\uBBF8\uC9C0`
|
|
63
|
-
}
|
|
64
|
-
] : []
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
122
|
+
}
|
|
123
|
+
] : [],
|
|
124
|
+
...props.images || [],
|
|
125
|
+
...props.collection?.map((portfolio) => portfolio.thumbnail) || []
|
|
126
|
+
].filter(Boolean);
|
|
127
|
+
const image = images.filter((file) => file.id).map((file) => ({
|
|
128
|
+
"@type": "ImageObject",
|
|
129
|
+
"@id": `${url}/#${file.id}`
|
|
130
|
+
}));
|
|
131
|
+
const breadcrumbSchemaId = `${url}#breadcrumb`;
|
|
132
|
+
const updatedAt = props.updatedAt;
|
|
133
|
+
const createdAt = props.createdAt;
|
|
134
|
+
const additionalStructedData = [
|
|
135
|
+
...typeof props.structedData === "function" ? props.structedData() : props.structedData || [],
|
|
136
|
+
...typeof config.structedData === "function" ? config.structedData() : config.structedData || []
|
|
137
|
+
];
|
|
138
|
+
const collectionMainEntity = props.collection ? {
|
|
139
|
+
"@type": "ItemList",
|
|
140
|
+
numberOfItems: props.collection.length,
|
|
141
|
+
itemListElement: props.collection.map((item, index) => ({
|
|
142
|
+
"@type": "ListItem",
|
|
143
|
+
position: index + 1,
|
|
144
|
+
url: item.url,
|
|
145
|
+
item: {
|
|
146
|
+
"@type": "WebPage",
|
|
147
|
+
"@id": `${item.url}#webpage`,
|
|
148
|
+
url: item.url,
|
|
149
|
+
name: item.title,
|
|
150
|
+
thumbnailUrl: item.thumbnail?.url,
|
|
151
|
+
dateModified: item.updatedAt?.toISOString(),
|
|
152
|
+
dateCreated: item.createdAt?.toISOString(),
|
|
153
|
+
datePublished: item.createdAt?.toISOString()
|
|
154
|
+
}
|
|
155
|
+
}))
|
|
156
|
+
} : void 0;
|
|
157
|
+
const structuredData = {
|
|
158
|
+
"@context": "https://schema.org",
|
|
159
|
+
"@graph": [
|
|
160
|
+
{
|
|
161
|
+
"@type": "WebPage",
|
|
162
|
+
"@id": `${url}#webpage`,
|
|
163
|
+
url,
|
|
164
|
+
name: pageTitle,
|
|
165
|
+
description,
|
|
166
|
+
keywords,
|
|
167
|
+
dateModified: updatedAt?.toISOString(),
|
|
168
|
+
datePublished: createdAt?.toISOString(),
|
|
169
|
+
dateCreated: createdAt?.toISOString(),
|
|
170
|
+
primaryImageOfPage: thumbnail ? {
|
|
171
|
+
"@id": thumbnailSchemaId
|
|
172
|
+
} : void 0,
|
|
173
|
+
isPartOf: {
|
|
174
|
+
"@id": websiteSchemaId
|
|
92
175
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
176
|
+
inLanguage: "ko",
|
|
177
|
+
breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0 ? {
|
|
178
|
+
"@id": breadcrumbSchemaId
|
|
179
|
+
} : void 0,
|
|
180
|
+
image,
|
|
181
|
+
mainEntity: collectionMainEntity
|
|
182
|
+
},
|
|
183
|
+
props.article && {
|
|
184
|
+
"@type": "Article",
|
|
185
|
+
"@id": `${url}#article`,
|
|
186
|
+
url,
|
|
187
|
+
name: pageTitle,
|
|
188
|
+
description,
|
|
189
|
+
keywords,
|
|
190
|
+
headline: pageTitle,
|
|
191
|
+
dateModified: updatedAt?.toISOString(),
|
|
192
|
+
datePublished: createdAt?.toISOString(),
|
|
193
|
+
dateCreated: createdAt?.toISOString(),
|
|
194
|
+
isPartOf: {
|
|
195
|
+
"@id": websiteSchemaId
|
|
105
196
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"@type": "
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
description,
|
|
170
|
-
keywords,
|
|
171
|
-
headline: pageTitle,
|
|
172
|
-
dateModified: updatedAt?.toISOString(),
|
|
173
|
-
datePublished: createdAt?.toISOString(),
|
|
174
|
-
dateCreated: createdAt?.toISOString(),
|
|
175
|
-
isPartOf: {
|
|
176
|
-
"@id": websiteSchemaId
|
|
177
|
-
},
|
|
178
|
-
inLanguage: "ko",
|
|
179
|
-
image
|
|
180
|
-
},
|
|
181
|
-
props.blogPosting && {
|
|
182
|
-
"@type": "BlogPosting",
|
|
183
|
-
"@id": `${url}/#blogposting`,
|
|
184
|
-
url,
|
|
185
|
-
headline: pageTitle,
|
|
186
|
-
description,
|
|
187
|
-
thumbnailUrl,
|
|
188
|
-
datePublished: createdAt?.toISOString(),
|
|
189
|
-
dateModified: updatedAt?.toISOString(),
|
|
190
|
-
isPartOf: { "@id": websiteSchemaId },
|
|
191
|
-
image
|
|
192
|
-
},
|
|
193
|
-
props.creativeWork && {
|
|
194
|
-
"@type": "CreativeWork",
|
|
195
|
-
"@id": `${url}/#creativework`,
|
|
196
|
-
url,
|
|
197
|
-
name: pageTitle,
|
|
198
|
-
description,
|
|
199
|
-
datePublished: createdAt?.toISOString(),
|
|
200
|
-
dateModified: updatedAt?.toISOString(),
|
|
201
|
-
isPartOf: { "@id": websiteSchemaId },
|
|
202
|
-
thumbnailUrl,
|
|
203
|
-
image
|
|
204
|
-
},
|
|
205
|
-
props.visualArtwork && {
|
|
206
|
-
"@type": "VisualArtwork",
|
|
207
|
-
"@id": `${url}/#visualartwork`,
|
|
208
|
-
url,
|
|
209
|
-
name: pageTitle,
|
|
210
|
-
description,
|
|
211
|
-
datePublished: createdAt?.toISOString(),
|
|
212
|
-
dateModified: updatedAt?.toISOString(),
|
|
213
|
-
isPartOf: { "@id": websiteSchemaId },
|
|
214
|
-
thumbnailUrl,
|
|
215
|
-
image
|
|
216
|
-
},
|
|
217
|
-
props.collection && {
|
|
218
|
-
"@type": "CollectionPage",
|
|
219
|
-
"@id": `${url}/#collectionpage`,
|
|
220
|
-
url,
|
|
221
|
-
name: pageTitle,
|
|
222
|
-
description,
|
|
223
|
-
isPartOf: { "@id": websiteSchemaId },
|
|
224
|
-
image,
|
|
225
|
-
inLanguage: "ko-KR",
|
|
226
|
-
breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0 ? {
|
|
227
|
-
"@id": `${url}/#breadcrumb`
|
|
228
|
-
} : void 0,
|
|
229
|
-
mainEntity: collectionMainEntity
|
|
230
|
-
},
|
|
231
|
-
websiteSchema,
|
|
232
|
-
props.breadcrumbs && props.breadcrumbs.length > 0 && {
|
|
233
|
-
"@id": breadcrumbSchemaId,
|
|
234
|
-
"@type": "BreadcrumbList",
|
|
235
|
-
itemListElement: props.breadcrumbs.map((breadcrumb, index) => ({
|
|
236
|
-
"@type": "ListItem",
|
|
237
|
-
position: index + 1,
|
|
238
|
-
name: breadcrumb.label,
|
|
239
|
-
item: `${config.origin}${breadcrumb.href}`
|
|
240
|
-
}))
|
|
241
|
-
},
|
|
242
|
-
...additionalStructedData,
|
|
243
|
-
...images.map((file) => {
|
|
244
|
-
return {
|
|
245
|
-
"@type": "ImageObject",
|
|
246
|
-
"@id": `${url}/#${file.id}`,
|
|
247
|
-
url: file.url,
|
|
248
|
-
contentUrl: file.url,
|
|
249
|
-
name: file.alt,
|
|
250
|
-
description: file.alt,
|
|
251
|
-
width: file?.width?.toString(),
|
|
252
|
-
height: file?.height?.toString(),
|
|
253
|
-
creditText: config.copyright,
|
|
254
|
-
license: `${config.origin}/terms`,
|
|
255
|
-
copyrightNotice: config.copyright,
|
|
256
|
-
acquireLicensePage: `${config.origin}/terms`
|
|
257
|
-
};
|
|
197
|
+
inLanguage: "ko",
|
|
198
|
+
image
|
|
199
|
+
},
|
|
200
|
+
props.blogPosting && {
|
|
201
|
+
"@type": "BlogPosting",
|
|
202
|
+
"@id": `${url}/#blogposting`,
|
|
203
|
+
url,
|
|
204
|
+
headline: pageTitle,
|
|
205
|
+
description,
|
|
206
|
+
thumbnailUrl,
|
|
207
|
+
datePublished: createdAt?.toISOString(),
|
|
208
|
+
dateModified: updatedAt?.toISOString(),
|
|
209
|
+
isPartOf: { "@id": websiteSchemaId },
|
|
210
|
+
image
|
|
211
|
+
},
|
|
212
|
+
props.creativeWork && {
|
|
213
|
+
"@type": "CreativeWork",
|
|
214
|
+
"@id": `${url}/#creativework`,
|
|
215
|
+
url,
|
|
216
|
+
name: pageTitle,
|
|
217
|
+
description,
|
|
218
|
+
datePublished: createdAt?.toISOString(),
|
|
219
|
+
dateModified: updatedAt?.toISOString(),
|
|
220
|
+
isPartOf: { "@id": websiteSchemaId },
|
|
221
|
+
thumbnailUrl,
|
|
222
|
+
image
|
|
223
|
+
},
|
|
224
|
+
props.visualArtwork && {
|
|
225
|
+
"@type": "VisualArtwork",
|
|
226
|
+
"@id": `${url}/#visualartwork`,
|
|
227
|
+
url,
|
|
228
|
+
name: pageTitle,
|
|
229
|
+
description,
|
|
230
|
+
datePublished: createdAt?.toISOString(),
|
|
231
|
+
dateModified: updatedAt?.toISOString(),
|
|
232
|
+
isPartOf: { "@id": websiteSchemaId },
|
|
233
|
+
thumbnailUrl,
|
|
234
|
+
image
|
|
235
|
+
},
|
|
236
|
+
props.collection && {
|
|
237
|
+
"@type": "CollectionPage",
|
|
238
|
+
"@id": `${url}/#collectionpage`,
|
|
239
|
+
url,
|
|
240
|
+
name: pageTitle,
|
|
241
|
+
description,
|
|
242
|
+
isPartOf: { "@id": websiteSchemaId },
|
|
243
|
+
image,
|
|
244
|
+
inLanguage: "ko-KR",
|
|
245
|
+
breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0 ? {
|
|
246
|
+
"@id": `${url}/#breadcrumb`
|
|
247
|
+
} : void 0,
|
|
248
|
+
mainEntity: collectionMainEntity
|
|
249
|
+
},
|
|
250
|
+
websiteSchema,
|
|
251
|
+
props.breadcrumbs && props.breadcrumbs.length > 0 && {
|
|
252
|
+
"@id": breadcrumbSchemaId,
|
|
253
|
+
"@type": "BreadcrumbList",
|
|
254
|
+
itemListElement: props.breadcrumbs.map(
|
|
255
|
+
(breadcrumb, index) => ({
|
|
256
|
+
"@type": "ListItem",
|
|
257
|
+
position: index + 1,
|
|
258
|
+
name: breadcrumb.title,
|
|
259
|
+
item: `${config.origin}${breadcrumb.href}`
|
|
258
260
|
})
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
261
|
+
)
|
|
262
|
+
},
|
|
263
|
+
...additionalStructedData,
|
|
264
|
+
...images.map((file) => {
|
|
265
|
+
return {
|
|
266
|
+
"@type": "ImageObject",
|
|
267
|
+
"@id": `${url}/#${file.id}`,
|
|
268
|
+
url: file.url,
|
|
269
|
+
contentUrl: file.url,
|
|
270
|
+
name: file.alt,
|
|
271
|
+
description: file.alt,
|
|
272
|
+
width: file?.width?.toString(),
|
|
273
|
+
height: file?.height?.toString(),
|
|
274
|
+
creditText: config.copyright,
|
|
275
|
+
license: `${config.origin}/terms`,
|
|
276
|
+
copyrightNotice: config.copyright,
|
|
277
|
+
acquireLicensePage: `${config.origin}/terms`
|
|
278
|
+
};
|
|
279
|
+
})
|
|
280
|
+
].filter(Boolean)
|
|
281
|
+
};
|
|
282
|
+
return /* @__PURE__ */ import_react.default.createElement("script", { type: "application/ld+json" }, JSON.stringify(structuredData));
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
config,
|
|
286
|
+
init,
|
|
287
|
+
meta,
|
|
288
|
+
StructedData
|
|
281
289
|
};
|
|
282
290
|
}
|
|
283
291
|
// Annotate the CommonJS export names for ESM import in node:
|