@opinly/next 0.1.26 → 1.0.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/config.cjs +16 -7
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +7 -2
- package/dist/config.d.ts +7 -2
- package/dist/config.js +16 -7
- package/dist/config.js.map +1 -1
- package/dist/index.cjs +33 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/json-ld.cjs +61 -0
- package/dist/json-ld.cjs.map +1 -0
- package/dist/json-ld.d.cts +17 -0
- package/dist/json-ld.d.ts +17 -0
- package/dist/json-ld.js +38 -0
- package/dist/json-ld.js.map +1 -0
- package/dist/utils/generate-metadata.cjs +23 -79
- package/dist/utils/generate-metadata.cjs.map +1 -1
- package/dist/utils/generate-metadata.d.cts +11 -2
- package/dist/utils/generate-metadata.d.ts +11 -2
- package/dist/utils/generate-metadata.js +23 -79
- package/dist/utils/generate-metadata.js.map +1 -1
- package/dist/utils/generate-sitemap-xml.cjs.map +1 -1
- package/dist/utils/generate-sitemap-xml.d.cts +5 -3
- package/dist/utils/generate-sitemap-xml.d.ts +5 -3
- package/dist/utils/generate-sitemap-xml.js.map +1 -1
- package/dist/utils/sdk-config.cjs +6 -2
- package/dist/utils/sdk-config.cjs.map +1 -1
- package/dist/utils/sdk-config.d.cts +4 -0
- package/dist/utils/sdk-config.d.ts +4 -0
- package/dist/utils/sdk-config.js +6 -2
- package/dist/utils/sdk-config.js.map +1 -1
- package/package.json +10 -19
- package/dist/components/author-page/_helpers/json-ld.cjs +0 -44
- package/dist/components/author-page/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/author-page/_helpers/json-ld.d.cts +0 -8
- package/dist/components/author-page/_helpers/json-ld.d.ts +0 -8
- package/dist/components/author-page/_helpers/json-ld.js +0 -20
- package/dist/components/author-page/_helpers/json-ld.js.map +0 -1
- package/dist/components/author-page/index.cjs +0 -104
- package/dist/components/author-page/index.cjs.map +0 -1
- package/dist/components/author-page/index.d.cts +0 -10
- package/dist/components/author-page/index.d.ts +0 -10
- package/dist/components/author-page/index.js +0 -70
- package/dist/components/author-page/index.js.map +0 -1
- package/dist/components/authors-page/_helpers/json-ld.cjs +0 -53
- package/dist/components/authors-page/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/authors-page/_helpers/json-ld.d.cts +0 -8
- package/dist/components/authors-page/_helpers/json-ld.d.ts +0 -8
- package/dist/components/authors-page/_helpers/json-ld.js +0 -29
- package/dist/components/authors-page/_helpers/json-ld.js.map +0 -1
- package/dist/components/authors-page/index.cjs +0 -121
- package/dist/components/authors-page/index.cjs.map +0 -1
- package/dist/components/authors-page/index.d.cts +0 -10
- package/dist/components/authors-page/index.d.ts +0 -10
- package/dist/components/authors-page/index.js +0 -87
- package/dist/components/authors-page/index.js.map +0 -1
- package/dist/components/blog-post/_components/content.cjs +0 -157
- package/dist/components/blog-post/_components/content.cjs.map +0 -1
- package/dist/components/blog-post/_components/content.d.cts +0 -10
- package/dist/components/blog-post/_components/content.d.ts +0 -10
- package/dist/components/blog-post/_components/content.js +0 -123
- package/dist/components/blog-post/_components/content.js.map +0 -1
- package/dist/components/blog-post/_components/faq.cjs +0 -39
- package/dist/components/blog-post/_components/faq.cjs.map +0 -1
- package/dist/components/blog-post/_components/faq.d.cts +0 -9
- package/dist/components/blog-post/_components/faq.d.ts +0 -9
- package/dist/components/blog-post/_components/faq.js +0 -15
- package/dist/components/blog-post/_components/faq.js.map +0 -1
- package/dist/components/blog-post/_components/share.cjs +0 -100
- package/dist/components/blog-post/_components/share.cjs.map +0 -1
- package/dist/components/blog-post/_components/share.d.cts +0 -9
- package/dist/components/blog-post/_components/share.d.ts +0 -9
- package/dist/components/blog-post/_components/share.js +0 -66
- package/dist/components/blog-post/_components/share.js.map +0 -1
- package/dist/components/blog-post/_components/table-of-contents.cjs +0 -111
- package/dist/components/blog-post/_components/table-of-contents.cjs.map +0 -1
- package/dist/components/blog-post/_components/table-of-contents.d.cts +0 -14
- package/dist/components/blog-post/_components/table-of-contents.d.ts +0 -14
- package/dist/components/blog-post/_components/table-of-contents.js +0 -77
- package/dist/components/blog-post/_components/table-of-contents.js.map +0 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs +0 -2
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.d.cts +0 -2
- package/dist/components/blog-post/_helpers/calc-reading-time.d.ts +0 -2
- package/dist/components/blog-post/_helpers/calc-reading-time.js +0 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.js.map +0 -1
- package/dist/components/blog-post/_helpers/extract-headings.cjs +0 -45
- package/dist/components/blog-post/_helpers/extract-headings.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/extract-headings.d.cts +0 -9
- package/dist/components/blog-post/_helpers/extract-headings.d.ts +0 -9
- package/dist/components/blog-post/_helpers/extract-headings.js +0 -21
- package/dist/components/blog-post/_helpers/extract-headings.js.map +0 -1
- package/dist/components/blog-post/_helpers/json-ld.cjs +0 -162
- package/dist/components/blog-post/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/json-ld.d.cts +0 -15
- package/dist/components/blog-post/_helpers/json-ld.d.ts +0 -15
- package/dist/components/blog-post/_helpers/json-ld.js +0 -135
- package/dist/components/blog-post/_helpers/json-ld.js.map +0 -1
- package/dist/components/blog-post/_helpers/reading-time.cjs +0 -50
- package/dist/components/blog-post/_helpers/reading-time.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/reading-time.d.cts +0 -6
- package/dist/components/blog-post/_helpers/reading-time.d.ts +0 -6
- package/dist/components/blog-post/_helpers/reading-time.js +0 -25
- package/dist/components/blog-post/_helpers/reading-time.js.map +0 -1
- package/dist/components/blog-post/_types/blog-post.cjs +0 -17
- package/dist/components/blog-post/_types/blog-post.cjs.map +0 -1
- package/dist/components/blog-post/_types/blog-post.d.cts +0 -7
- package/dist/components/blog-post/_types/blog-post.d.ts +0 -7
- package/dist/components/blog-post/_types/blog-post.js +0 -1
- package/dist/components/blog-post/_types/blog-post.js.map +0 -1
- package/dist/components/blog-post/_types/class-names.cjs +0 -17
- package/dist/components/blog-post/_types/class-names.cjs.map +0 -1
- package/dist/components/blog-post/_types/class-names.d.cts +0 -12
- package/dist/components/blog-post/_types/class-names.d.ts +0 -12
- package/dist/components/blog-post/_types/class-names.js +0 -1
- package/dist/components/blog-post/_types/class-names.js.map +0 -1
- package/dist/components/blog-post/index.cjs +0 -133
- package/dist/components/blog-post/index.cjs.map +0 -1
- package/dist/components/blog-post/index.d.cts +0 -15
- package/dist/components/blog-post/index.d.ts +0 -15
- package/dist/components/blog-post/index.js +0 -99
- package/dist/components/blog-post/index.js.map +0 -1
- package/dist/components/bread-crumbs.cjs +0 -60
- package/dist/components/bread-crumbs.cjs.map +0 -1
- package/dist/components/bread-crumbs.d.cts +0 -10
- package/dist/components/bread-crumbs.d.ts +0 -10
- package/dist/components/bread-crumbs.js +0 -26
- package/dist/components/bread-crumbs.js.map +0 -1
- package/dist/components/folder-page/_helpers/json-ld.cjs +0 -43
- package/dist/components/folder-page/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/folder-page/_helpers/json-ld.d.cts +0 -8
- package/dist/components/folder-page/_helpers/json-ld.d.ts +0 -8
- package/dist/components/folder-page/_helpers/json-ld.js +0 -19
- package/dist/components/folder-page/_helpers/json-ld.js.map +0 -1
- package/dist/components/folder-page/index.cjs +0 -84
- package/dist/components/folder-page/index.cjs.map +0 -1
- package/dist/components/folder-page/index.d.cts +0 -10
- package/dist/components/folder-page/index.d.ts +0 -10
- package/dist/components/folder-page/index.js +0 -60
- package/dist/components/folder-page/index.js.map +0 -1
- package/dist/components/home-page/_helpers/json-ld.cjs +0 -43
- package/dist/components/home-page/_helpers/json-ld.cjs.map +0 -1
- package/dist/components/home-page/_helpers/json-ld.d.cts +0 -3
- package/dist/components/home-page/_helpers/json-ld.d.ts +0 -3
- package/dist/components/home-page/_helpers/json-ld.js +0 -19
- package/dist/components/home-page/_helpers/json-ld.js.map +0 -1
- package/dist/components/home-page/folders.cjs +0 -108
- package/dist/components/home-page/folders.cjs.map +0 -1
- package/dist/components/home-page/folders.d.cts +0 -11
- package/dist/components/home-page/folders.d.ts +0 -11
- package/dist/components/home-page/folders.js +0 -73
- package/dist/components/home-page/folders.js.map +0 -1
- package/dist/components/home-page/index.cjs +0 -50
- package/dist/components/home-page/index.cjs.map +0 -1
- package/dist/components/home-page/index.d.cts +0 -14
- package/dist/components/home-page/index.d.ts +0 -14
- package/dist/components/home-page/index.js +0 -26
- package/dist/components/home-page/index.js.map +0 -1
- package/dist/components/home-page/pagination.cjs +0 -97
- package/dist/components/home-page/pagination.cjs.map +0 -1
- package/dist/components/home-page/pagination.d.cts +0 -9
- package/dist/components/home-page/pagination.d.ts +0 -9
- package/dist/components/home-page/pagination.js +0 -63
- package/dist/components/home-page/pagination.js.map +0 -1
- package/dist/components/home-page/top-posts.cjs +0 -35
- package/dist/components/home-page/top-posts.cjs.map +0 -1
- package/dist/components/home-page/top-posts.d.cts +0 -10
- package/dist/components/home-page/top-posts.d.ts +0 -10
- package/dist/components/home-page/top-posts.js +0 -11
- package/dist/components/home-page/top-posts.js.map +0 -1
- package/dist/components/json-ld.cjs +0 -92
- package/dist/components/json-ld.cjs.map +0 -1
- package/dist/components/json-ld.d.cts +0 -13
- package/dist/components/json-ld.d.ts +0 -13
- package/dist/components/json-ld.js +0 -57
- package/dist/components/json-ld.js.map +0 -1
- package/dist/components/opinly-blog.cjs +0 -57
- package/dist/components/opinly-blog.cjs.map +0 -1
- package/dist/components/opinly-blog.d.cts +0 -15
- package/dist/components/opinly-blog.d.ts +0 -15
- package/dist/components/opinly-blog.js +0 -33
- package/dist/components/opinly-blog.js.map +0 -1
- package/dist/components/post-preview.cjs +0 -114
- package/dist/components/post-preview.cjs.map +0 -1
- package/dist/components/post-preview.d.cts +0 -10
- package/dist/components/post-preview.d.ts +0 -10
- package/dist/components/post-preview.js +0 -79
- package/dist/components/post-preview.js.map +0 -1
- package/dist/pages/index.cjs +0 -23
- package/dist/pages/index.cjs.map +0 -1
- package/dist/pages/index.d.cts +0 -3
- package/dist/pages/index.d.ts +0 -3
- package/dist/pages/index.js +0 -2
- package/dist/pages/index.js.map +0 -1
- package/dist/pages/opinly-blog-pages.cjs +0 -127
- package/dist/pages/opinly-blog-pages.cjs.map +0 -1
- package/dist/pages/opinly-blog-pages.d.cts +0 -9
- package/dist/pages/opinly-blog-pages.d.ts +0 -9
- package/dist/pages/opinly-blog-pages.js +0 -103
- package/dist/pages/opinly-blog-pages.js.map +0 -1
- package/dist/utils/json-ld.cjs +0 -2
- package/dist/utils/json-ld.cjs.map +0 -1
- package/dist/utils/json-ld.d.cts +0 -2
- package/dist/utils/json-ld.d.ts +0 -2
- package/dist/utils/json-ld.js +0 -1
- package/dist/utils/json-ld.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/generate-metadata.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/generate-metadata.ts"],"sourcesContent":["import type { Metadata, ResolvingMetadata } from \"next\";\nimport { buildMetadata, type SeoResolved } from \"@opinly/shared\";\nimport { opinlyConfig } from \"./sdk-config\";\n\n/**\n * Build Next.js metadata for a blog route from already-resolved content.\n *\n * The consumer resolves the route once (e.g. `opinly.lookup(slug)` /\n * `opinly.author(slug)`) — for both rendering and metadata — and passes the\n * result here as a `SeoResolved` (`{ type, data }`). Shared extraction lives in\n * @opinly/shared's `buildMetadata`; this only reshapes the neutral `OpinlyMeta`\n * into a Next `Metadata` object. Avoids a second fetch in `generateMetadata`.\n */\nexport const generateOpinlyMetadata = async (\n resolved: SeoResolved,\n parent: ResolvingMetadata,\n): Promise<Metadata> => {\n const base = (await parent) as Metadata;\n const meta = buildMetadata(resolved, {\n imagesPrefix: opinlyConfig.imagesPrefix,\n siteUrl: opinlyConfig.siteUrl,\n blogPrefix: opinlyConfig.blogPrefix,\n siteName: opinlyConfig.siteName,\n categoryPrefix: opinlyConfig.categoryPrefix,\n authorPrefix: opinlyConfig.authorPrefix,\n });\n\n return {\n ...base,\n title: meta.title,\n description: meta.description,\n openGraph: {\n title: meta.title,\n description: meta.description,\n type: meta.ogType ?? \"website\",\n images: meta.ogImage ? [meta.ogImage] : undefined,\n },\n ...(meta.authors ? { authors: meta.authors } : {}),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAgD;AAChD,wBAA6B;AAWtB,MAAM,yBAAyB,OACpC,UACA,WACsB;AACtB,QAAM,OAAQ,MAAM;AACpB,QAAM,WAAO,6BAAc,UAAU;AAAA,IACnC,cAAc,+BAAa;AAAA,IAC3B,SAAS,+BAAa;AAAA,IACtB,YAAY,+BAAa;AAAA,IACzB,UAAU,+BAAa;AAAA,IACvB,gBAAgB,+BAAa;AAAA,IAC7B,cAAc,+BAAa;AAAA,EAC7B,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,KAAK;AAAA,IACZ,aAAa,KAAK;AAAA,IAClB,WAAW;AAAA,MACT,OAAO,KAAK;AAAA,MACZ,aAAa,KAAK;AAAA,MAClB,MAAM,KAAK,UAAU;AAAA,MACrB,QAAQ,KAAK,UAAU,CAAC,KAAK,OAAO,IAAI;AAAA,IAC1C;AAAA,IACA,GAAI,KAAK,UAAU,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;AAAA,EAClD;AACF;","names":[]}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { Opinly, OpinlyPagePropsPromisified } from '@opinly/backend';
|
|
2
1
|
import { ResolvingMetadata, Metadata } from 'next';
|
|
2
|
+
import { SeoResolved } from '@opinly/shared';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Build Next.js metadata for a blog route from already-resolved content.
|
|
6
|
+
*
|
|
7
|
+
* The consumer resolves the route once (e.g. `opinly.lookup(slug)` /
|
|
8
|
+
* `opinly.author(slug)`) — for both rendering and metadata — and passes the
|
|
9
|
+
* result here as a `SeoResolved` (`{ type, data }`). Shared extraction lives in
|
|
10
|
+
* @opinly/shared's `buildMetadata`; this only reshapes the neutral `OpinlyMeta`
|
|
11
|
+
* into a Next `Metadata` object. Avoids a second fetch in `generateMetadata`.
|
|
12
|
+
*/
|
|
13
|
+
declare const generateOpinlyMetadata: (resolved: SeoResolved, parent: ResolvingMetadata) => Promise<Metadata>;
|
|
5
14
|
|
|
6
15
|
export { generateOpinlyMetadata };
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { Opinly, OpinlyPagePropsPromisified } from '@opinly/backend';
|
|
2
1
|
import { ResolvingMetadata, Metadata } from 'next';
|
|
2
|
+
import { SeoResolved } from '@opinly/shared';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Build Next.js metadata for a blog route from already-resolved content.
|
|
6
|
+
*
|
|
7
|
+
* The consumer resolves the route once (e.g. `opinly.lookup(slug)` /
|
|
8
|
+
* `opinly.author(slug)`) — for both rendering and metadata — and passes the
|
|
9
|
+
* result here as a `SeoResolved` (`{ type, data }`). Shared extraction lives in
|
|
10
|
+
* @opinly/shared's `buildMetadata`; this only reshapes the neutral `OpinlyMeta`
|
|
11
|
+
* into a Next `Metadata` object. Avoids a second fetch in `generateMetadata`.
|
|
12
|
+
*/
|
|
13
|
+
declare const generateOpinlyMetadata: (resolved: SeoResolved, parent: ResolvingMetadata) => Promise<Metadata>;
|
|
5
14
|
|
|
6
15
|
export { generateOpinlyMetadata };
|
|
@@ -1,83 +1,27 @@
|
|
|
1
|
+
import { buildMetadata } from "@opinly/shared";
|
|
1
2
|
import { opinlyConfig } from "./sdk-config";
|
|
2
|
-
const generateOpinlyMetadata = async (
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
title: blog.data.title,
|
|
25
|
-
description: blog.data.description,
|
|
26
|
-
openGraph: {
|
|
27
|
-
images,
|
|
28
|
-
type: "article",
|
|
29
|
-
authors: blog.data.author && [
|
|
30
|
-
`${opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`
|
|
31
|
-
],
|
|
32
|
-
title: blog.data.title
|
|
33
|
-
},
|
|
34
|
-
// keywords: [blog.data.keywords],
|
|
35
|
-
authors: blog.data.author && [
|
|
36
|
-
{
|
|
37
|
-
name: blog.data.author.name,
|
|
38
|
-
url: `${opinlyConfig.imagesPrefix}/authors/${blog.data.author.slug}`
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
other: {}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
if (blog.type === "author") {
|
|
45
|
-
const authorImageKey = blog.data.image?.fileKey;
|
|
46
|
-
const images = authorImageKey ? [`${opinlyConfig.imagesPrefix}/${authorImageKey}`] : [];
|
|
47
|
-
return {
|
|
48
|
-
...parent,
|
|
49
|
-
title: blog.data.name,
|
|
50
|
-
description: blog.data.bio || void 0,
|
|
51
|
-
openGraph: {
|
|
52
|
-
images: images.length > 0 ? images : void 0,
|
|
53
|
-
title: blog.data.name,
|
|
54
|
-
description: blog.data.bio || void 0
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
if (blog.type === "authors") {
|
|
59
|
-
return {
|
|
60
|
-
...parent,
|
|
61
|
-
title: `${opinlyConfig.siteName} Blog - Authors`,
|
|
62
|
-
description: `Browse all authors on the ${opinlyConfig.siteName} Blog`,
|
|
63
|
-
openGraph: {
|
|
64
|
-
title: `${opinlyConfig.siteName} Blog - Authors`,
|
|
65
|
-
description: `Browse all authors on the ${opinlyConfig.siteName} Blog`
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
if (blog.type === "folder") {
|
|
70
|
-
return {
|
|
71
|
-
...parent,
|
|
72
|
-
title: `${opinlyConfig.siteName} Blog - Folder: ${blog.data.name}`,
|
|
73
|
-
description: blog.data.description || void 0,
|
|
74
|
-
openGraph: {
|
|
75
|
-
title: `${opinlyConfig.siteName} Blog - Folder: ${blog.data.name}`,
|
|
76
|
-
description: blog.data.description || void 0
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
return parent;
|
|
3
|
+
const generateOpinlyMetadata = async (resolved, parent) => {
|
|
4
|
+
const base = await parent;
|
|
5
|
+
const meta = buildMetadata(resolved, {
|
|
6
|
+
imagesPrefix: opinlyConfig.imagesPrefix,
|
|
7
|
+
siteUrl: opinlyConfig.siteUrl,
|
|
8
|
+
blogPrefix: opinlyConfig.blogPrefix,
|
|
9
|
+
siteName: opinlyConfig.siteName,
|
|
10
|
+
categoryPrefix: opinlyConfig.categoryPrefix,
|
|
11
|
+
authorPrefix: opinlyConfig.authorPrefix
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
...base,
|
|
15
|
+
title: meta.title,
|
|
16
|
+
description: meta.description,
|
|
17
|
+
openGraph: {
|
|
18
|
+
title: meta.title,
|
|
19
|
+
description: meta.description,
|
|
20
|
+
type: meta.ogType ?? "website",
|
|
21
|
+
images: meta.ogImage ? [meta.ogImage] : void 0
|
|
22
|
+
},
|
|
23
|
+
...meta.authors ? { authors: meta.authors } : {}
|
|
24
|
+
};
|
|
81
25
|
};
|
|
82
26
|
export {
|
|
83
27
|
generateOpinlyMetadata
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/generate-metadata.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/generate-metadata.ts"],"sourcesContent":["import type { Metadata, ResolvingMetadata } from \"next\";\nimport { buildMetadata, type SeoResolved } from \"@opinly/shared\";\nimport { opinlyConfig } from \"./sdk-config\";\n\n/**\n * Build Next.js metadata for a blog route from already-resolved content.\n *\n * The consumer resolves the route once (e.g. `opinly.lookup(slug)` /\n * `opinly.author(slug)`) — for both rendering and metadata — and passes the\n * result here as a `SeoResolved` (`{ type, data }`). Shared extraction lives in\n * @opinly/shared's `buildMetadata`; this only reshapes the neutral `OpinlyMeta`\n * into a Next `Metadata` object. Avoids a second fetch in `generateMetadata`.\n */\nexport const generateOpinlyMetadata = async (\n resolved: SeoResolved,\n parent: ResolvingMetadata,\n): Promise<Metadata> => {\n const base = (await parent) as Metadata;\n const meta = buildMetadata(resolved, {\n imagesPrefix: opinlyConfig.imagesPrefix,\n siteUrl: opinlyConfig.siteUrl,\n blogPrefix: opinlyConfig.blogPrefix,\n siteName: opinlyConfig.siteName,\n categoryPrefix: opinlyConfig.categoryPrefix,\n authorPrefix: opinlyConfig.authorPrefix,\n });\n\n return {\n ...base,\n title: meta.title,\n description: meta.description,\n openGraph: {\n title: meta.title,\n description: meta.description,\n type: meta.ogType ?? \"website\",\n images: meta.ogImage ? [meta.ogImage] : undefined,\n },\n ...(meta.authors ? { authors: meta.authors } : {}),\n };\n};\n"],"mappings":"AACA,SAAS,qBAAuC;AAChD,SAAS,oBAAoB;AAWtB,MAAM,yBAAyB,OACpC,UACA,WACsB;AACtB,QAAM,OAAQ,MAAM;AACpB,QAAM,OAAO,cAAc,UAAU;AAAA,IACnC,cAAc,aAAa;AAAA,IAC3B,SAAS,aAAa;AAAA,IACtB,YAAY,aAAa;AAAA,IACzB,UAAU,aAAa;AAAA,IACvB,gBAAgB,aAAa;AAAA,IAC7B,cAAc,aAAa;AAAA,EAC7B,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,KAAK;AAAA,IACZ,aAAa,KAAK;AAAA,IAClB,WAAW;AAAA,MACT,OAAO,KAAK;AAAA,MACZ,aAAa,KAAK;AAAA,MAClB,MAAM,KAAK,UAAU;AAAA,MACrB,QAAQ,KAAK,UAAU,CAAC,KAAK,OAAO,IAAI;AAAA,IAC1C;AAAA,IACA,GAAI,KAAK,UAAU,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;AAAA,EAClD;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/generate-sitemap-xml.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/generate-sitemap-xml.ts"],"sourcesContent":["/** Build a sitemap.xml string from resolved `{ url, lastModified }` records. */\nexport function generateSiteMapXML(\n paths: { url: string; lastModified: string | Date }[],\n) {\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <urlset xmlns=\"https://www.sitemaps.org/schemas/sitemap/0.9\">\n ${paths\n .map(({ url, lastModified }) => {\n return `\n <url>\n <loc>${url}</loc>\n <lastmod>${lastModified}</lastmod>\n </url>\n `;\n })\n .join(\"\")}\n </urlset>\n `;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,SAAS,mBACd,OACA;AACA,SAAO;AAAA;AAAA,OAEF,MACC,IAAI,CAAC,EAAE,KAAK,aAAa,MAAM;AAC9B,WAAO;AAAA;AAAA,qBAEK,GAAG;AAAA,yBACC,YAAY;AAAA;AAAA;AAAA,EAG9B,CAAC,EACA,KAAK,EAAE,CAAC;AAAA;AAAA;AAGhB;","names":[]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/** Build a sitemap.xml string from resolved `{ url, lastModified }` records. */
|
|
2
|
+
declare function generateSiteMapXML(paths: {
|
|
3
|
+
url: string;
|
|
4
|
+
lastModified: string | Date;
|
|
5
|
+
}[]): string;
|
|
4
6
|
|
|
5
7
|
export { generateSiteMapXML };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/** Build a sitemap.xml string from resolved `{ url, lastModified }` records. */
|
|
2
|
+
declare function generateSiteMapXML(paths: {
|
|
3
|
+
url: string;
|
|
4
|
+
lastModified: string | Date;
|
|
5
|
+
}[]): string;
|
|
4
6
|
|
|
5
7
|
export { generateSiteMapXML };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/generate-sitemap-xml.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/generate-sitemap-xml.ts"],"sourcesContent":["/** Build a sitemap.xml string from resolved `{ url, lastModified }` records. */\nexport function generateSiteMapXML(\n paths: { url: string; lastModified: string | Date }[],\n) {\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <urlset xmlns=\"https://www.sitemaps.org/schemas/sitemap/0.9\">\n ${paths\n .map(({ url, lastModified }) => {\n return `\n <url>\n <loc>${url}</loc>\n <lastmod>${lastModified}</lastmod>\n </url>\n `;\n })\n .join(\"\")}\n </urlset>\n `;\n}\n"],"mappings":"AACO,SAAS,mBACd,OACA;AACA,SAAO;AAAA;AAAA,OAEF,MACC,IAAI,CAAC,EAAE,KAAK,aAAa,MAAM;AAC9B,WAAO;AAAA;AAAA,qBAEK,GAAG;AAAA,yBACC,YAAY;AAAA;AAAA;AAAA,EAG9B,CAAC,EACA,KAAK,EAAE,CAAC;AAAA;AAAA;AAGhB;","names":[]}
|
|
@@ -29,7 +29,9 @@ const opinlyEnvVars = {
|
|
|
29
29
|
OPINLY_BLOG_PREFIX: process.env.OPINLY_BLOG_PREFIX,
|
|
30
30
|
OPINLY_SITE_NAME: process.env.OPINLY_SITE_NAME,
|
|
31
31
|
OPINLY_UNOPTIMIZED_IMAGES: process.env.OPINLY_UNOPTIMIZED_IMAGES,
|
|
32
|
-
OPINLY_PAGES_ROUTER: process.env.OPINLY_PAGES_ROUTER
|
|
32
|
+
OPINLY_PAGES_ROUTER: process.env.OPINLY_PAGES_ROUTER,
|
|
33
|
+
OPINLY_CATEGORY_PREFIX: process.env.OPINLY_CATEGORY_PREFIX,
|
|
34
|
+
OPINLY_AUTHOR_PREFIX: process.env.OPINLY_AUTHOR_PREFIX
|
|
33
35
|
};
|
|
34
36
|
let opinlyConfig = {
|
|
35
37
|
cdnUrl: process.env.OPINLY_CDN_URL || "https://cdn.opinly.ai",
|
|
@@ -40,7 +42,9 @@ let opinlyConfig = {
|
|
|
40
42
|
blogUrl: `${process.env.OPINLY_SITE_URL}${process.env.OPINLY_BLOG_PREFIX}`,
|
|
41
43
|
siteName: process.env.OPINLY_SITE_NAME,
|
|
42
44
|
unoptimizedImages: process.env.OPINLY_UNOPTIMIZED_IMAGES === "true" ? true : void 0,
|
|
43
|
-
pagesRouter: process.env.OPINLY_PAGES_ROUTER === "true" ? true : false
|
|
45
|
+
pagesRouter: process.env.OPINLY_PAGES_ROUTER === "true" ? true : false,
|
|
46
|
+
categoryPrefix: process.env.OPINLY_CATEGORY_PREFIX || void 0,
|
|
47
|
+
authorPrefix: process.env.OPINLY_AUTHOR_PREFIX || void 0
|
|
44
48
|
};
|
|
45
49
|
function setOpinlyConfig(newConfig) {
|
|
46
50
|
opinlyConfig = { ...opinlyConfig, ...newConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/sdk-config.ts"],"sourcesContent":["const siteUrl = process.env.OPINLY_SITE_URL;\n\nconst opinlyEnvVars = {\n OPINLY_IMAGES_PREFIX: process.env.OPINLY_IMAGES_PREFIX as string,\n OPINLY_SITE_URL: process.env.OPINLY_SITE_URL as string,\n OPINLY_BLOG_PREFIX: process.env.OPINLY_BLOG_PREFIX as string,\n OPINLY_SITE_NAME: process.env.OPINLY_SITE_NAME as string,\n OPINLY_UNOPTIMIZED_IMAGES: process.env.OPINLY_UNOPTIMIZED_IMAGES as\n | string\n | undefined,\n OPINLY_PAGES_ROUTER: process.env.OPINLY_PAGES_ROUTER,\n};\n\nexport type OpinlyEnvVars = typeof opinlyEnvVars;\n\nexport let opinlyConfig: {\n cdnUrl: string;\n imagesPrefix: string;\n imagesUrl: string;\n siteUrl: string;\n blogPrefix: string;\n blogUrl: string;\n siteName: string;\n unoptimizedImages?: boolean;\n pagesRouter: boolean;\n} = {\n cdnUrl: process.env.OPINLY_CDN_URL || \"https://cdn.opinly.ai\",\n siteUrl: process.env.OPINLY_SITE_URL as string,\n imagesPrefix: process.env.OPINLY_IMAGES_PREFIX as string,\n imagesUrl: process.env.OPINLY_IMAGES_PREFIX?.startsWith(\"/\")\n ? `${process.env.OPINLY_SITE_URL as string}${\n process.env.OPINLY_IMAGES_PREFIX as string\n }`\n : (process.env.OPINLY_IMAGES_PREFIX as string),\n blogPrefix: process.env.OPINLY_BLOG_PREFIX as string,\n blogUrl: `${process.env.OPINLY_SITE_URL as string}${\n process.env.OPINLY_BLOG_PREFIX as string\n }`,\n siteName: process.env.OPINLY_SITE_NAME as string,\n unoptimizedImages:\n process.env.OPINLY_UNOPTIMIZED_IMAGES === \"true\" ? true : undefined,\n pagesRouter: process.env.OPINLY_PAGES_ROUTER === \"true\" ? true : false,\n};\n\nexport function setOpinlyConfig(newConfig: typeof opinlyConfig) {\n opinlyConfig = { ...opinlyConfig, ...newConfig };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,UAAU,QAAQ,IAAI;AAE5B,MAAM,gBAAgB;AAAA,EACpB,sBAAsB,QAAQ,IAAI;AAAA,EAClC,iBAAiB,QAAQ,IAAI;AAAA,EAC7B,oBAAoB,QAAQ,IAAI;AAAA,EAChC,kBAAkB,QAAQ,IAAI;AAAA,EAC9B,2BAA2B,QAAQ,IAAI;AAAA,EAGvC,qBAAqB,QAAQ,IAAI;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/sdk-config.ts"],"sourcesContent":["const siteUrl = process.env.OPINLY_SITE_URL;\n\nconst opinlyEnvVars = {\n OPINLY_IMAGES_PREFIX: process.env.OPINLY_IMAGES_PREFIX as string,\n OPINLY_SITE_URL: process.env.OPINLY_SITE_URL as string,\n OPINLY_BLOG_PREFIX: process.env.OPINLY_BLOG_PREFIX as string,\n OPINLY_SITE_NAME: process.env.OPINLY_SITE_NAME as string,\n OPINLY_UNOPTIMIZED_IMAGES: process.env.OPINLY_UNOPTIMIZED_IMAGES as\n | string\n | undefined,\n OPINLY_PAGES_ROUTER: process.env.OPINLY_PAGES_ROUTER,\n OPINLY_CATEGORY_PREFIX: process.env.OPINLY_CATEGORY_PREFIX as\n | string\n | undefined,\n OPINLY_AUTHOR_PREFIX: process.env.OPINLY_AUTHOR_PREFIX as string | undefined,\n};\n\nexport type OpinlyEnvVars = typeof opinlyEnvVars;\n\nexport let opinlyConfig: {\n cdnUrl: string;\n imagesPrefix: string;\n imagesUrl: string;\n siteUrl: string;\n blogPrefix: string;\n blogUrl: string;\n siteName: string;\n unoptimizedImages?: boolean;\n pagesRouter: boolean;\n categoryPrefix?: string;\n authorPrefix?: string;\n} = {\n cdnUrl: process.env.OPINLY_CDN_URL || \"https://cdn.opinly.ai\",\n siteUrl: process.env.OPINLY_SITE_URL as string,\n imagesPrefix: process.env.OPINLY_IMAGES_PREFIX as string,\n imagesUrl: process.env.OPINLY_IMAGES_PREFIX?.startsWith(\"/\")\n ? `${process.env.OPINLY_SITE_URL as string}${\n process.env.OPINLY_IMAGES_PREFIX as string\n }`\n : (process.env.OPINLY_IMAGES_PREFIX as string),\n blogPrefix: process.env.OPINLY_BLOG_PREFIX as string,\n blogUrl: `${process.env.OPINLY_SITE_URL as string}${\n process.env.OPINLY_BLOG_PREFIX as string\n }`,\n siteName: process.env.OPINLY_SITE_NAME as string,\n unoptimizedImages:\n process.env.OPINLY_UNOPTIMIZED_IMAGES === \"true\" ? true : undefined,\n pagesRouter: process.env.OPINLY_PAGES_ROUTER === \"true\" ? true : false,\n categoryPrefix: process.env.OPINLY_CATEGORY_PREFIX || undefined,\n authorPrefix: process.env.OPINLY_AUTHOR_PREFIX || undefined,\n};\n\nexport function setOpinlyConfig(newConfig: typeof opinlyConfig) {\n opinlyConfig = { ...opinlyConfig, ...newConfig };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,UAAU,QAAQ,IAAI;AAE5B,MAAM,gBAAgB;AAAA,EACpB,sBAAsB,QAAQ,IAAI;AAAA,EAClC,iBAAiB,QAAQ,IAAI;AAAA,EAC7B,oBAAoB,QAAQ,IAAI;AAAA,EAChC,kBAAkB,QAAQ,IAAI;AAAA,EAC9B,2BAA2B,QAAQ,IAAI;AAAA,EAGvC,qBAAqB,QAAQ,IAAI;AAAA,EACjC,wBAAwB,QAAQ,IAAI;AAAA,EAGpC,sBAAsB,QAAQ,IAAI;AACpC;AAIO,IAAI,eAYP;AAAA,EACF,QAAQ,QAAQ,IAAI,kBAAkB;AAAA,EACtC,SAAS,QAAQ,IAAI;AAAA,EACrB,cAAc,QAAQ,IAAI;AAAA,EAC1B,WAAW,QAAQ,IAAI,sBAAsB,WAAW,GAAG,IACvD,GAAG,QAAQ,IAAI,eAAyB,GACtC,QAAQ,IAAI,oBACd,KACC,QAAQ,IAAI;AAAA,EACjB,YAAY,QAAQ,IAAI;AAAA,EACxB,SAAS,GAAG,QAAQ,IAAI,eAAyB,GAC/C,QAAQ,IAAI,kBACd;AAAA,EACA,UAAU,QAAQ,IAAI;AAAA,EACtB,mBACE,QAAQ,IAAI,8BAA8B,SAAS,OAAO;AAAA,EAC5D,aAAa,QAAQ,IAAI,wBAAwB,SAAS,OAAO;AAAA,EACjE,gBAAgB,QAAQ,IAAI,0BAA0B;AAAA,EACtD,cAAc,QAAQ,IAAI,wBAAwB;AACpD;AAEO,SAAS,gBAAgB,WAAgC;AAC9D,iBAAe,EAAE,GAAG,cAAc,GAAG,UAAU;AACjD;","names":[]}
|
|
@@ -5,6 +5,8 @@ declare const opinlyEnvVars: {
|
|
|
5
5
|
OPINLY_SITE_NAME: string;
|
|
6
6
|
OPINLY_UNOPTIMIZED_IMAGES: string | undefined;
|
|
7
7
|
OPINLY_PAGES_ROUTER: string | undefined;
|
|
8
|
+
OPINLY_CATEGORY_PREFIX: string | undefined;
|
|
9
|
+
OPINLY_AUTHOR_PREFIX: string | undefined;
|
|
8
10
|
};
|
|
9
11
|
type OpinlyEnvVars = typeof opinlyEnvVars;
|
|
10
12
|
declare let opinlyConfig: {
|
|
@@ -17,6 +19,8 @@ declare let opinlyConfig: {
|
|
|
17
19
|
siteName: string;
|
|
18
20
|
unoptimizedImages?: boolean;
|
|
19
21
|
pagesRouter: boolean;
|
|
22
|
+
categoryPrefix?: string;
|
|
23
|
+
authorPrefix?: string;
|
|
20
24
|
};
|
|
21
25
|
declare function setOpinlyConfig(newConfig: typeof opinlyConfig): void;
|
|
22
26
|
|
|
@@ -5,6 +5,8 @@ declare const opinlyEnvVars: {
|
|
|
5
5
|
OPINLY_SITE_NAME: string;
|
|
6
6
|
OPINLY_UNOPTIMIZED_IMAGES: string | undefined;
|
|
7
7
|
OPINLY_PAGES_ROUTER: string | undefined;
|
|
8
|
+
OPINLY_CATEGORY_PREFIX: string | undefined;
|
|
9
|
+
OPINLY_AUTHOR_PREFIX: string | undefined;
|
|
8
10
|
};
|
|
9
11
|
type OpinlyEnvVars = typeof opinlyEnvVars;
|
|
10
12
|
declare let opinlyConfig: {
|
|
@@ -17,6 +19,8 @@ declare let opinlyConfig: {
|
|
|
17
19
|
siteName: string;
|
|
18
20
|
unoptimizedImages?: boolean;
|
|
19
21
|
pagesRouter: boolean;
|
|
22
|
+
categoryPrefix?: string;
|
|
23
|
+
authorPrefix?: string;
|
|
20
24
|
};
|
|
21
25
|
declare function setOpinlyConfig(newConfig: typeof opinlyConfig): void;
|
|
22
26
|
|
package/dist/utils/sdk-config.js
CHANGED
|
@@ -5,7 +5,9 @@ const opinlyEnvVars = {
|
|
|
5
5
|
OPINLY_BLOG_PREFIX: process.env.OPINLY_BLOG_PREFIX,
|
|
6
6
|
OPINLY_SITE_NAME: process.env.OPINLY_SITE_NAME,
|
|
7
7
|
OPINLY_UNOPTIMIZED_IMAGES: process.env.OPINLY_UNOPTIMIZED_IMAGES,
|
|
8
|
-
OPINLY_PAGES_ROUTER: process.env.OPINLY_PAGES_ROUTER
|
|
8
|
+
OPINLY_PAGES_ROUTER: process.env.OPINLY_PAGES_ROUTER,
|
|
9
|
+
OPINLY_CATEGORY_PREFIX: process.env.OPINLY_CATEGORY_PREFIX,
|
|
10
|
+
OPINLY_AUTHOR_PREFIX: process.env.OPINLY_AUTHOR_PREFIX
|
|
9
11
|
};
|
|
10
12
|
let opinlyConfig = {
|
|
11
13
|
cdnUrl: process.env.OPINLY_CDN_URL || "https://cdn.opinly.ai",
|
|
@@ -16,7 +18,9 @@ let opinlyConfig = {
|
|
|
16
18
|
blogUrl: `${process.env.OPINLY_SITE_URL}${process.env.OPINLY_BLOG_PREFIX}`,
|
|
17
19
|
siteName: process.env.OPINLY_SITE_NAME,
|
|
18
20
|
unoptimizedImages: process.env.OPINLY_UNOPTIMIZED_IMAGES === "true" ? true : void 0,
|
|
19
|
-
pagesRouter: process.env.OPINLY_PAGES_ROUTER === "true" ? true : false
|
|
21
|
+
pagesRouter: process.env.OPINLY_PAGES_ROUTER === "true" ? true : false,
|
|
22
|
+
categoryPrefix: process.env.OPINLY_CATEGORY_PREFIX || void 0,
|
|
23
|
+
authorPrefix: process.env.OPINLY_AUTHOR_PREFIX || void 0
|
|
20
24
|
};
|
|
21
25
|
function setOpinlyConfig(newConfig) {
|
|
22
26
|
opinlyConfig = { ...opinlyConfig, ...newConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/sdk-config.ts"],"sourcesContent":["const siteUrl = process.env.OPINLY_SITE_URL;\n\nconst opinlyEnvVars = {\n OPINLY_IMAGES_PREFIX: process.env.OPINLY_IMAGES_PREFIX as string,\n OPINLY_SITE_URL: process.env.OPINLY_SITE_URL as string,\n OPINLY_BLOG_PREFIX: process.env.OPINLY_BLOG_PREFIX as string,\n OPINLY_SITE_NAME: process.env.OPINLY_SITE_NAME as string,\n OPINLY_UNOPTIMIZED_IMAGES: process.env.OPINLY_UNOPTIMIZED_IMAGES as\n | string\n | undefined,\n OPINLY_PAGES_ROUTER: process.env.OPINLY_PAGES_ROUTER,\n};\n\nexport type OpinlyEnvVars = typeof opinlyEnvVars;\n\nexport let opinlyConfig: {\n cdnUrl: string;\n imagesPrefix: string;\n imagesUrl: string;\n siteUrl: string;\n blogPrefix: string;\n blogUrl: string;\n siteName: string;\n unoptimizedImages?: boolean;\n pagesRouter: boolean;\n} = {\n cdnUrl: process.env.OPINLY_CDN_URL || \"https://cdn.opinly.ai\",\n siteUrl: process.env.OPINLY_SITE_URL as string,\n imagesPrefix: process.env.OPINLY_IMAGES_PREFIX as string,\n imagesUrl: process.env.OPINLY_IMAGES_PREFIX?.startsWith(\"/\")\n ? `${process.env.OPINLY_SITE_URL as string}${\n process.env.OPINLY_IMAGES_PREFIX as string\n }`\n : (process.env.OPINLY_IMAGES_PREFIX as string),\n blogPrefix: process.env.OPINLY_BLOG_PREFIX as string,\n blogUrl: `${process.env.OPINLY_SITE_URL as string}${\n process.env.OPINLY_BLOG_PREFIX as string\n }`,\n siteName: process.env.OPINLY_SITE_NAME as string,\n unoptimizedImages:\n process.env.OPINLY_UNOPTIMIZED_IMAGES === \"true\" ? true : undefined,\n pagesRouter: process.env.OPINLY_PAGES_ROUTER === \"true\" ? true : false,\n};\n\nexport function setOpinlyConfig(newConfig: typeof opinlyConfig) {\n opinlyConfig = { ...opinlyConfig, ...newConfig };\n}\n"],"mappings":"AAAA,MAAM,UAAU,QAAQ,IAAI;AAE5B,MAAM,gBAAgB;AAAA,EACpB,sBAAsB,QAAQ,IAAI;AAAA,EAClC,iBAAiB,QAAQ,IAAI;AAAA,EAC7B,oBAAoB,QAAQ,IAAI;AAAA,EAChC,kBAAkB,QAAQ,IAAI;AAAA,EAC9B,2BAA2B,QAAQ,IAAI;AAAA,EAGvC,qBAAqB,QAAQ,IAAI;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/sdk-config.ts"],"sourcesContent":["const siteUrl = process.env.OPINLY_SITE_URL;\n\nconst opinlyEnvVars = {\n OPINLY_IMAGES_PREFIX: process.env.OPINLY_IMAGES_PREFIX as string,\n OPINLY_SITE_URL: process.env.OPINLY_SITE_URL as string,\n OPINLY_BLOG_PREFIX: process.env.OPINLY_BLOG_PREFIX as string,\n OPINLY_SITE_NAME: process.env.OPINLY_SITE_NAME as string,\n OPINLY_UNOPTIMIZED_IMAGES: process.env.OPINLY_UNOPTIMIZED_IMAGES as\n | string\n | undefined,\n OPINLY_PAGES_ROUTER: process.env.OPINLY_PAGES_ROUTER,\n OPINLY_CATEGORY_PREFIX: process.env.OPINLY_CATEGORY_PREFIX as\n | string\n | undefined,\n OPINLY_AUTHOR_PREFIX: process.env.OPINLY_AUTHOR_PREFIX as string | undefined,\n};\n\nexport type OpinlyEnvVars = typeof opinlyEnvVars;\n\nexport let opinlyConfig: {\n cdnUrl: string;\n imagesPrefix: string;\n imagesUrl: string;\n siteUrl: string;\n blogPrefix: string;\n blogUrl: string;\n siteName: string;\n unoptimizedImages?: boolean;\n pagesRouter: boolean;\n categoryPrefix?: string;\n authorPrefix?: string;\n} = {\n cdnUrl: process.env.OPINLY_CDN_URL || \"https://cdn.opinly.ai\",\n siteUrl: process.env.OPINLY_SITE_URL as string,\n imagesPrefix: process.env.OPINLY_IMAGES_PREFIX as string,\n imagesUrl: process.env.OPINLY_IMAGES_PREFIX?.startsWith(\"/\")\n ? `${process.env.OPINLY_SITE_URL as string}${\n process.env.OPINLY_IMAGES_PREFIX as string\n }`\n : (process.env.OPINLY_IMAGES_PREFIX as string),\n blogPrefix: process.env.OPINLY_BLOG_PREFIX as string,\n blogUrl: `${process.env.OPINLY_SITE_URL as string}${\n process.env.OPINLY_BLOG_PREFIX as string\n }`,\n siteName: process.env.OPINLY_SITE_NAME as string,\n unoptimizedImages:\n process.env.OPINLY_UNOPTIMIZED_IMAGES === \"true\" ? true : undefined,\n pagesRouter: process.env.OPINLY_PAGES_ROUTER === \"true\" ? true : false,\n categoryPrefix: process.env.OPINLY_CATEGORY_PREFIX || undefined,\n authorPrefix: process.env.OPINLY_AUTHOR_PREFIX || undefined,\n};\n\nexport function setOpinlyConfig(newConfig: typeof opinlyConfig) {\n opinlyConfig = { ...opinlyConfig, ...newConfig };\n}\n"],"mappings":"AAAA,MAAM,UAAU,QAAQ,IAAI;AAE5B,MAAM,gBAAgB;AAAA,EACpB,sBAAsB,QAAQ,IAAI;AAAA,EAClC,iBAAiB,QAAQ,IAAI;AAAA,EAC7B,oBAAoB,QAAQ,IAAI;AAAA,EAChC,kBAAkB,QAAQ,IAAI;AAAA,EAC9B,2BAA2B,QAAQ,IAAI;AAAA,EAGvC,qBAAqB,QAAQ,IAAI;AAAA,EACjC,wBAAwB,QAAQ,IAAI;AAAA,EAGpC,sBAAsB,QAAQ,IAAI;AACpC;AAIO,IAAI,eAYP;AAAA,EACF,QAAQ,QAAQ,IAAI,kBAAkB;AAAA,EACtC,SAAS,QAAQ,IAAI;AAAA,EACrB,cAAc,QAAQ,IAAI;AAAA,EAC1B,WAAW,QAAQ,IAAI,sBAAsB,WAAW,GAAG,IACvD,GAAG,QAAQ,IAAI,eAAyB,GACtC,QAAQ,IAAI,oBACd,KACC,QAAQ,IAAI;AAAA,EACjB,YAAY,QAAQ,IAAI;AAAA,EACxB,SAAS,GAAG,QAAQ,IAAI,eAAyB,GAC/C,QAAQ,IAAI,kBACd;AAAA,EACA,UAAU,QAAQ,IAAI;AAAA,EACtB,mBACE,QAAQ,IAAI,8BAA8B,SAAS,OAAO;AAAA,EAC5D,aAAa,QAAQ,IAAI,wBAAwB,SAAS,OAAO;AAAA,EACjE,gBAAgB,QAAQ,IAAI,0BAA0B;AAAA,EACtD,cAAc,QAAQ,IAAI,wBAAwB;AACpD;AAEO,SAAS,gBAAgB,WAAgC;AAC9D,iBAAe,EAAE,GAAG,cAAc,GAAG,UAAU;AACjD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opinly/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -23,15 +23,12 @@
|
|
|
23
23
|
"tailwindcss": "^4.0.0 || ^3.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tiptap/core": "^2.12.0",
|
|
27
26
|
"clsx": "^2.1.1",
|
|
28
|
-
"lucide-react": "^0.553.0",
|
|
29
|
-
"next-seo": "^6.8.0",
|
|
30
|
-
"react-syntax-highlighter": "^15.6.1",
|
|
31
27
|
"schema-dts": "^1.1.5",
|
|
32
28
|
"tailwind-merge": "^1.14.0",
|
|
33
29
|
"zod": "^3.25.67",
|
|
34
|
-
"@opinly/backend": "0.
|
|
30
|
+
"@opinly/backend": "1.0.0",
|
|
31
|
+
"@opinly/shared": "1.0.0"
|
|
35
32
|
},
|
|
36
33
|
"engines": {
|
|
37
34
|
"node": ">=16"
|
|
@@ -48,29 +45,23 @@
|
|
|
48
45
|
"import": "./dist/index.js",
|
|
49
46
|
"require": "./dist/index.cjs"
|
|
50
47
|
},
|
|
51
|
-
"./pages": {
|
|
52
|
-
"import": "./dist/pages/index.js",
|
|
53
|
-
"require": "./dist/pages/index.cjs"
|
|
54
|
-
},
|
|
55
48
|
"./config": {
|
|
56
49
|
"import": "./dist/config.js",
|
|
57
50
|
"require": "./dist/config.cjs"
|
|
58
51
|
},
|
|
59
|
-
"./
|
|
60
|
-
"import": "./dist/
|
|
61
|
-
"require": "./dist/
|
|
52
|
+
"./json-ld": {
|
|
53
|
+
"import": "./dist/json-ld.js",
|
|
54
|
+
"require": "./dist/json-ld.cjs"
|
|
62
55
|
},
|
|
63
56
|
"./utils/*": {
|
|
64
57
|
"import": "./dist/utils/*.js",
|
|
65
58
|
"require": "./dist/utils/*.cjs"
|
|
66
59
|
}
|
|
67
60
|
},
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
]
|
|
73
|
-
}
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "git+https://github.com/opinly/opinly-sdk.git",
|
|
64
|
+
"directory": "packages/next"
|
|
74
65
|
},
|
|
75
66
|
"scripts": {
|
|
76
67
|
"build": "tsup",
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
var json_ld_exports = {};
|
|
20
|
-
__export(json_ld_exports, {
|
|
21
|
-
genPersonPostingJSONLD: () => genPersonPostingJSONLD
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(json_ld_exports);
|
|
24
|
-
var import_sdk_config = require("../../../utils/sdk-config");
|
|
25
|
-
const genPersonPostingJSONLD = (author) => {
|
|
26
|
-
const jsonLD = {
|
|
27
|
-
"@context": "https://schema.org",
|
|
28
|
-
"@type": "Person",
|
|
29
|
-
name: author.name,
|
|
30
|
-
description: author.bio || void 0,
|
|
31
|
-
url: `${import_sdk_config.opinlyConfig.blogUrl}/authors/${author.slug}`,
|
|
32
|
-
image: author.image.fileKey ? {
|
|
33
|
-
"@type": "ImageObject",
|
|
34
|
-
url: `${import_sdk_config.opinlyConfig.imagesUrl}/${author.image.fileKey}`,
|
|
35
|
-
caption: `Profile picture of ${author.name}`
|
|
36
|
-
} : void 0
|
|
37
|
-
};
|
|
38
|
-
return JSON.stringify(jsonLD);
|
|
39
|
-
};
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
genPersonPostingJSONLD
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=json-ld.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/author-page/_helpers/json-ld.ts"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport { Person, WithContext } from \"schema-dts\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\n\ntype AuthorRes = Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"author\" }\n>[\"data\"];\n\nexport const genPersonPostingJSONLD = (author: AuthorRes): string => {\n const jsonLD: WithContext<Exclude<Person, string>> = {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Person\",\n name: author.name,\n description: author.bio || undefined,\n url: `${opinlyConfig.blogUrl}/authors/${author.slug}`,\n image: author.image.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${author.image.fileKey}`,\n caption: `Profile picture of ${author.name}`,\n }\n : undefined,\n };\n\n return JSON.stringify(jsonLD);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wBAA6B;AAOtB,MAAM,yBAAyB,CAAC,WAA8B;AACnE,QAAM,SAA+C;AAAA,IACnD,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,MAAM,OAAO;AAAA,IACb,aAAa,OAAO,OAAO;AAAA,IAC3B,KAAK,GAAG,+BAAa,OAAO,YAAY,OAAO,IAAI;AAAA,IACnD,OAAO,OAAO,MAAM,UAChB;AAAA,MACE,SAAS;AAAA,MACT,KAAK,GAAG,+BAAa,SAAS,IAAI,OAAO,MAAM,OAAO;AAAA,MACtD,SAAS,sBAAsB,OAAO,IAAI;AAAA,IAC5C,IACA;AAAA,EACN;AAEA,SAAO,KAAK,UAAU,MAAM;AAC9B;","names":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { opinlyConfig } from "../../../utils/sdk-config";
|
|
2
|
-
const genPersonPostingJSONLD = (author) => {
|
|
3
|
-
const jsonLD = {
|
|
4
|
-
"@context": "https://schema.org",
|
|
5
|
-
"@type": "Person",
|
|
6
|
-
name: author.name,
|
|
7
|
-
description: author.bio || void 0,
|
|
8
|
-
url: `${opinlyConfig.blogUrl}/authors/${author.slug}`,
|
|
9
|
-
image: author.image.fileKey ? {
|
|
10
|
-
"@type": "ImageObject",
|
|
11
|
-
url: `${opinlyConfig.imagesUrl}/${author.image.fileKey}`,
|
|
12
|
-
caption: `Profile picture of ${author.name}`
|
|
13
|
-
} : void 0
|
|
14
|
-
};
|
|
15
|
-
return JSON.stringify(jsonLD);
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
genPersonPostingJSONLD
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=json-ld.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/author-page/_helpers/json-ld.ts"],"sourcesContent":["import { Opinly } from \"@opinly/backend\";\nimport { Person, WithContext } from \"schema-dts\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\n\ntype AuthorRes = Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"author\" }\n>[\"data\"];\n\nexport const genPersonPostingJSONLD = (author: AuthorRes): string => {\n const jsonLD: WithContext<Exclude<Person, string>> = {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Person\",\n name: author.name,\n description: author.bio || undefined,\n url: `${opinlyConfig.blogUrl}/authors/${author.slug}`,\n image: author.image.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${author.image.fileKey}`,\n caption: `Profile picture of ${author.name}`,\n }\n : undefined,\n };\n\n return JSON.stringify(jsonLD);\n};\n"],"mappings":"AAEA,SAAS,oBAAoB;AAOtB,MAAM,yBAAyB,CAAC,WAA8B;AACnE,QAAM,SAA+C;AAAA,IACnD,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,MAAM,OAAO;AAAA,IACb,aAAa,OAAO,OAAO;AAAA,IAC3B,KAAK,GAAG,aAAa,OAAO,YAAY,OAAO,IAAI;AAAA,IACnD,OAAO,OAAO,MAAM,UAChB;AAAA,MACE,SAAS;AAAA,MACT,KAAK,GAAG,aAAa,SAAS,IAAI,OAAO,MAAM,OAAO;AAAA,MACtD,SAAS,sBAAsB,OAAO,IAAI;AAAA,IAC5C,IACA;AAAA,EACN;AAEA,SAAO,KAAK,UAAU,MAAM;AAC9B;","names":[]}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var author_page_exports = {};
|
|
30
|
-
__export(author_page_exports, {
|
|
31
|
-
AuthorPage: () => AuthorPage
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(author_page_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var import_image = __toESM(require("next/image"), 1);
|
|
36
|
-
var import_sdk_config = require("../../utils/sdk-config");
|
|
37
|
-
var import_post_preview = require("../post-preview");
|
|
38
|
-
var import_bread_crumbs = require("../bread-crumbs");
|
|
39
|
-
var import_json_ld = require("../json-ld");
|
|
40
|
-
var import_json_ld2 = require("./_helpers/json-ld");
|
|
41
|
-
const AuthorPage = ({
|
|
42
|
-
author
|
|
43
|
-
}) => {
|
|
44
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
45
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
46
|
-
import_json_ld.OpinlyBreadCrumbJsonLd,
|
|
47
|
-
{
|
|
48
|
-
items: [
|
|
49
|
-
{
|
|
50
|
-
slugNoPrefixSlash: "authors",
|
|
51
|
-
name: "Authors"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
slugNoPrefixSlash: `authors/${author.slug}`,
|
|
55
|
-
name: author.name
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_json_ld.OpinlyJSONLD, { content: (0, import_json_ld2.genPersonPostingJSONLD)(author) }),
|
|
61
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-5xl mx-auto px-4 py-10", children: [
|
|
62
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
-
import_bread_crumbs.BreadCrumbs,
|
|
64
|
-
{
|
|
65
|
-
breadcrumbs: [
|
|
66
|
-
{
|
|
67
|
-
name: "Authors",
|
|
68
|
-
url: `${import_sdk_config.opinlyConfig.blogPrefix}/authors`
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-6 mb-10", children: [
|
|
74
|
-
author.image.fileKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
-
import_image.default,
|
|
76
|
-
{
|
|
77
|
-
unoptimized: import_sdk_config.opinlyConfig.unoptimizedImages,
|
|
78
|
-
src: `${import_sdk_config.opinlyConfig.imagesPrefix}/${author.image.fileKey}`,
|
|
79
|
-
alt: author.image.alt || author.name,
|
|
80
|
-
width: 150,
|
|
81
|
-
height: 150,
|
|
82
|
-
className: "rounded-full border"
|
|
83
|
-
}
|
|
84
|
-
),
|
|
85
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-3xl font-bold mb-1", children: author.name }),
|
|
87
|
-
author.bio && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground text-base max-w-2xl", children: author.bio })
|
|
88
|
-
] })
|
|
89
|
-
] }),
|
|
90
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { className: "text-xl font-semibold mb-6", children: [
|
|
91
|
-
"Posts by ",
|
|
92
|
-
author.name
|
|
93
|
-
] }),
|
|
94
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8", children: author.posts && author.posts.length > 0 ? author.posts.map(
|
|
95
|
-
(post) => post && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_preview.PostPreview, { post }, post.slug)
|
|
96
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground col-span-full", children: "No posts yet." }) })
|
|
97
|
-
] })
|
|
98
|
-
] });
|
|
99
|
-
};
|
|
100
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
-
0 && (module.exports = {
|
|
102
|
-
AuthorPage
|
|
103
|
-
});
|
|
104
|
-
//# sourceMappingURL=index.cjs.map
|