@scribe-atp/next 1.0.1 → 1.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/dist/index.cjs +51 -2
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +48 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,8 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
articleMetadata: () => articleMetadata,
|
|
23
24
|
createScribeSite: () => createScribeSite,
|
|
24
|
-
createWellKnownHandler: () => createWellKnownHandler
|
|
25
|
+
createWellKnownHandler: () => createWellKnownHandler,
|
|
26
|
+
siteMetadata: () => siteMetadata
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(index_exports);
|
|
27
29
|
|
|
@@ -87,8 +89,55 @@ function createWellKnownHandler(author, publicationUrl) {
|
|
|
87
89
|
return new Response(uri, { headers: { "Content-Type": "text/plain" } });
|
|
88
90
|
};
|
|
89
91
|
}
|
|
92
|
+
|
|
93
|
+
// src/meta.ts
|
|
94
|
+
var import_core2 = require("@scribe-atp/core");
|
|
95
|
+
function articleMetadata(article, site) {
|
|
96
|
+
const canonicalUrl = (0, import_core2.buildCanonicalUrl)(article, site);
|
|
97
|
+
return {
|
|
98
|
+
title: `${article.title} \u2014 ${site.title}`,
|
|
99
|
+
description: article.description ?? void 0,
|
|
100
|
+
openGraph: {
|
|
101
|
+
type: "article",
|
|
102
|
+
title: article.title,
|
|
103
|
+
description: article.description ?? void 0,
|
|
104
|
+
url: canonicalUrl,
|
|
105
|
+
siteName: site.title,
|
|
106
|
+
...article.splashImageUrl ? { images: [article.splashImageUrl] } : {}
|
|
107
|
+
},
|
|
108
|
+
twitter: {
|
|
109
|
+
card: article.splashImageUrl ? "summary_large_image" : "summary",
|
|
110
|
+
title: article.title,
|
|
111
|
+
description: article.description ?? void 0,
|
|
112
|
+
...article.splashImageUrl ? { images: [article.splashImageUrl] } : {}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function siteMetadata(site) {
|
|
117
|
+
const siteUrl = `https://${site.url}${site.urlPrefix ? `/${site.urlPrefix}` : ""}`;
|
|
118
|
+
return {
|
|
119
|
+
title: site.title,
|
|
120
|
+
description: site.description ?? void 0,
|
|
121
|
+
openGraph: {
|
|
122
|
+
type: "website",
|
|
123
|
+
title: site.title,
|
|
124
|
+
description: site.description ?? void 0,
|
|
125
|
+
url: siteUrl,
|
|
126
|
+
siteName: site.title,
|
|
127
|
+
...site.splashImageUrl ? { images: [site.splashImageUrl] } : {}
|
|
128
|
+
},
|
|
129
|
+
twitter: {
|
|
130
|
+
card: site.splashImageUrl ? "summary_large_image" : "summary",
|
|
131
|
+
title: site.title,
|
|
132
|
+
description: site.description ?? void 0,
|
|
133
|
+
...site.splashImageUrl ? { images: [site.splashImageUrl] } : {}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
90
137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
91
138
|
0 && (module.exports = {
|
|
139
|
+
articleMetadata,
|
|
92
140
|
createScribeSite,
|
|
93
|
-
createWellKnownHandler
|
|
141
|
+
createWellKnownHandler,
|
|
142
|
+
siteMetadata
|
|
94
143
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Metadata } from 'next';
|
|
2
|
+
import { Article, Site } from '@scribe-atp/core';
|
|
2
3
|
export { Article, ArticleRef, Site, SiteGroup } from '@scribe-atp/core';
|
|
3
4
|
|
|
4
5
|
declare function createScribeSite(author: string, publicationUrl: string): {
|
|
@@ -19,4 +20,7 @@ declare function createScribeSite(author: string, publicationUrl: string): {
|
|
|
19
20
|
};
|
|
20
21
|
declare function createWellKnownHandler(author: string, publicationUrl: string): (request: Request) => Promise<Response>;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
declare function articleMetadata(article: Article, site: Site): Metadata;
|
|
24
|
+
declare function siteMetadata(site: Site): Metadata;
|
|
25
|
+
|
|
26
|
+
export { articleMetadata, createScribeSite, createWellKnownHandler, siteMetadata };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Metadata } from 'next';
|
|
2
|
+
import { Article, Site } from '@scribe-atp/core';
|
|
2
3
|
export { Article, ArticleRef, Site, SiteGroup } from '@scribe-atp/core';
|
|
3
4
|
|
|
4
5
|
declare function createScribeSite(author: string, publicationUrl: string): {
|
|
@@ -19,4 +20,7 @@ declare function createScribeSite(author: string, publicationUrl: string): {
|
|
|
19
20
|
};
|
|
20
21
|
declare function createWellKnownHandler(author: string, publicationUrl: string): (request: Request) => Promise<Response>;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
declare function articleMetadata(article: Article, site: Site): Metadata;
|
|
24
|
+
declare function siteMetadata(site: Site): Metadata;
|
|
25
|
+
|
|
26
|
+
export { articleMetadata, createScribeSite, createWellKnownHandler, siteMetadata };
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,54 @@ function createWellKnownHandler(author, publicationUrl) {
|
|
|
60
60
|
return new Response(uri, { headers: { "Content-Type": "text/plain" } });
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
// src/meta.ts
|
|
65
|
+
import { buildCanonicalUrl } from "@scribe-atp/core";
|
|
66
|
+
function articleMetadata(article, site) {
|
|
67
|
+
const canonicalUrl = buildCanonicalUrl(article, site);
|
|
68
|
+
return {
|
|
69
|
+
title: `${article.title} \u2014 ${site.title}`,
|
|
70
|
+
description: article.description ?? void 0,
|
|
71
|
+
openGraph: {
|
|
72
|
+
type: "article",
|
|
73
|
+
title: article.title,
|
|
74
|
+
description: article.description ?? void 0,
|
|
75
|
+
url: canonicalUrl,
|
|
76
|
+
siteName: site.title,
|
|
77
|
+
...article.splashImageUrl ? { images: [article.splashImageUrl] } : {}
|
|
78
|
+
},
|
|
79
|
+
twitter: {
|
|
80
|
+
card: article.splashImageUrl ? "summary_large_image" : "summary",
|
|
81
|
+
title: article.title,
|
|
82
|
+
description: article.description ?? void 0,
|
|
83
|
+
...article.splashImageUrl ? { images: [article.splashImageUrl] } : {}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function siteMetadata(site) {
|
|
88
|
+
const siteUrl = `https://${site.url}${site.urlPrefix ? `/${site.urlPrefix}` : ""}`;
|
|
89
|
+
return {
|
|
90
|
+
title: site.title,
|
|
91
|
+
description: site.description ?? void 0,
|
|
92
|
+
openGraph: {
|
|
93
|
+
type: "website",
|
|
94
|
+
title: site.title,
|
|
95
|
+
description: site.description ?? void 0,
|
|
96
|
+
url: siteUrl,
|
|
97
|
+
siteName: site.title,
|
|
98
|
+
...site.splashImageUrl ? { images: [site.splashImageUrl] } : {}
|
|
99
|
+
},
|
|
100
|
+
twitter: {
|
|
101
|
+
card: site.splashImageUrl ? "summary_large_image" : "summary",
|
|
102
|
+
title: site.title,
|
|
103
|
+
description: site.description ?? void 0,
|
|
104
|
+
...site.splashImageUrl ? { images: [site.splashImageUrl] } : {}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
63
108
|
export {
|
|
109
|
+
articleMetadata,
|
|
64
110
|
createScribeSite,
|
|
65
|
-
createWellKnownHandler
|
|
111
|
+
createWellKnownHandler,
|
|
112
|
+
siteMetadata
|
|
66
113
|
};
|