@unhead/schema-org 0.2.2 → 0.3.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/dist/index.cjs +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +6 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1585,6 +1585,12 @@ const resolveMeta = (meta) => {
|
|
|
1585
1585
|
meta.host = document.location.host;
|
|
1586
1586
|
if (!meta.url && meta.canonicalUrl)
|
|
1587
1587
|
meta.url = meta.canonicalUrl;
|
|
1588
|
+
if (meta.path !== "/") {
|
|
1589
|
+
if (meta.trailingSlash && !hasTrailingSlash(meta.path))
|
|
1590
|
+
meta.path = withTrailingSlash(meta.path);
|
|
1591
|
+
else if (!meta.trailingSlash && hasTrailingSlash(meta.path))
|
|
1592
|
+
meta.path = withoutTrailingSlash(meta.path);
|
|
1593
|
+
}
|
|
1588
1594
|
meta.url = joinURL(meta.host, meta.path);
|
|
1589
1595
|
return {
|
|
1590
1596
|
...meta,
|
package/dist/index.d.ts
CHANGED
|
@@ -1340,12 +1340,14 @@ interface ResolvedMeta {
|
|
|
1340
1340
|
description?: string;
|
|
1341
1341
|
datePublished?: string;
|
|
1342
1342
|
dateModified?: string;
|
|
1343
|
+
trailingSlash?: boolean;
|
|
1343
1344
|
}
|
|
1344
1345
|
interface MetaInput {
|
|
1345
1346
|
/**
|
|
1346
1347
|
* Whether to inject the scripts at the end of the body or in the head.
|
|
1347
1348
|
*/
|
|
1348
1349
|
tagPosition?: 'body' | 'head';
|
|
1350
|
+
trailingSlash?: boolean;
|
|
1349
1351
|
host: string;
|
|
1350
1352
|
url?: string;
|
|
1351
1353
|
path?: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1583,6 +1583,12 @@ const resolveMeta = (meta) => {
|
|
|
1583
1583
|
meta.host = document.location.host;
|
|
1584
1584
|
if (!meta.url && meta.canonicalUrl)
|
|
1585
1585
|
meta.url = meta.canonicalUrl;
|
|
1586
|
+
if (meta.path !== "/") {
|
|
1587
|
+
if (meta.trailingSlash && !hasTrailingSlash(meta.path))
|
|
1588
|
+
meta.path = withTrailingSlash(meta.path);
|
|
1589
|
+
else if (!meta.trailingSlash && hasTrailingSlash(meta.path))
|
|
1590
|
+
meta.path = withoutTrailingSlash(meta.path);
|
|
1591
|
+
}
|
|
1586
1592
|
meta.url = joinURL(meta.host, meta.path);
|
|
1587
1593
|
return {
|
|
1588
1594
|
...meta,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/schema-org",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"packageManager": "pnpm@7.8.0",
|
|
5
5
|
"description": "Node Schema.org for Simple and Automated Google Rich Results",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"ufo": "^1.0.1",
|
|
41
|
-
"unhead": "^1.0.
|
|
41
|
+
"unhead": "^1.0.14"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "unbuild .",
|