@opinly/next 0.1.12 → 0.1.14
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/components/author-page/_helpers/json-ld.js +1 -0
- package/dist/components/author-page/_helpers/json-ld.mjs +1 -0
- package/dist/components/author-page/index.js +57 -22
- package/dist/components/author-page/index.js.map +1 -1
- package/dist/components/author-page/index.mjs +50 -0
- package/dist/components/author-page/index.mjs.map +1 -0
- package/dist/components/authors-page/index.js +63 -29
- package/dist/components/authors-page/index.js.map +1 -1
- package/dist/components/authors-page/index.mjs +71 -0
- package/dist/components/authors-page/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/components/blog-post/_components/content.js +63 -28
- package/dist/components/blog-post/_components/content.js.map +1 -1
- package/dist/components/blog-post/_components/content.mjs +126 -0
- package/dist/components/blog-post/_components/content.mjs.map +1 -0
- package/dist/components/blog-post/_components/faq.js +32 -8
- package/dist/components/blog-post/_components/faq.js.map +1 -1
- package/dist/components/blog-post/_components/faq.mjs +15 -0
- package/dist/components/blog-post/_components/{faq.cjs.map → faq.mjs.map} +1 -1
- package/dist/components/blog-post/_components/share.js +58 -24
- package/dist/components/blog-post/_components/share.js.map +1 -1
- package/dist/components/blog-post/_components/share.mjs +66 -0
- package/dist/components/blog-post/_components/{share.cjs.map → share.mjs.map} +1 -1
- package/dist/components/blog-post/_components/table-of-contents.js +58 -23
- package/dist/components/blog-post/_components/table-of-contents.js.map +1 -1
- package/dist/components/blog-post/_components/table-of-contents.mjs +48 -0
- package/dist/components/blog-post/_components/table-of-contents.mjs.map +1 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.js +1 -0
- package/dist/components/blog-post/_helpers/calc-reading-time.mjs +1 -0
- package/dist/components/blog-post/_helpers/extract-headings.js +26 -2
- package/dist/components/blog-post/_helpers/extract-headings.js.map +1 -1
- package/dist/components/blog-post/_helpers/extract-headings.mjs +20 -0
- package/dist/components/blog-post/_helpers/{extract-headings.cjs.map → extract-headings.mjs.map} +1 -1
- package/dist/components/blog-post/_helpers/json-ld.js +38 -11
- package/dist/components/blog-post/_helpers/json-ld.js.map +1 -1
- package/dist/components/blog-post/_helpers/{json-ld.cjs → json-ld.mjs} +12 -39
- package/dist/components/blog-post/_helpers/{json-ld.cjs.map → json-ld.mjs.map} +1 -1
- package/dist/components/blog-post/_helpers/reading-time.js +27 -2
- package/dist/components/blog-post/_helpers/reading-time.js.map +1 -1
- package/dist/components/blog-post/_helpers/reading-time.mjs +25 -0
- package/dist/components/blog-post/_helpers/{reading-time.cjs.map → reading-time.mjs.map} +1 -1
- package/dist/components/blog-post/_types/blog-post.js +16 -0
- package/dist/components/blog-post/_types/blog-post.js.map +1 -1
- package/dist/components/blog-post/_types/blog-post.mjs +1 -0
- package/dist/components/blog-post/_types/blog-post.mjs.map +1 -0
- package/dist/components/blog-post/_types/class-names.js +16 -0
- package/dist/components/blog-post/_types/class-names.js.map +1 -1
- package/dist/components/blog-post/_types/class-names.mjs +1 -0
- package/dist/components/blog-post/_types/class-names.mjs.map +1 -0
- package/dist/components/blog-post/index.js +77 -47
- package/dist/components/blog-post/index.js.map +1 -1
- package/dist/components/blog-post/index.mjs +118 -0
- package/dist/components/blog-post/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/components/bread-crumbs.js +47 -13
- package/dist/components/bread-crumbs.js.map +1 -1
- package/dist/components/bread-crumbs.mjs +26 -0
- package/dist/components/{bread-crumbs.cjs.map → bread-crumbs.mjs.map} +1 -1
- package/dist/components/folder-page/index.js +36 -12
- package/dist/components/folder-page/index.js.map +1 -1
- package/dist/components/folder-page/index.mjs +37 -0
- package/dist/components/folder-page/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/components/home-page/folders.js +64 -29
- package/dist/components/home-page/folders.js.map +1 -1
- package/dist/components/home-page/folders.mjs +63 -0
- package/dist/components/home-page/{folders.cjs.map → folders.mjs.map} +1 -1
- package/dist/components/home-page/index.js +35 -11
- package/dist/components/home-page/index.js.map +1 -1
- package/dist/components/home-page/index.mjs +20 -0
- package/dist/components/home-page/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/components/home-page/pagination.js +43 -9
- package/dist/components/home-page/pagination.js.map +1 -1
- package/dist/components/home-page/pagination.mjs +57 -0
- package/dist/components/home-page/{pagination.cjs.map → pagination.mjs.map} +1 -1
- package/dist/components/home-page/top-posts.js +34 -10
- package/dist/components/home-page/top-posts.js.map +1 -1
- package/dist/components/home-page/top-posts.mjs +28 -0
- package/dist/components/home-page/{top-posts.cjs.map → top-posts.mjs.map} +1 -1
- package/dist/components/not-found.js +49 -15
- package/dist/components/not-found.js.map +1 -1
- package/dist/components/not-found.mjs +26 -0
- package/dist/components/{not-found.cjs.map → not-found.mjs.map} +1 -1
- package/dist/components/opinly-blog.js +39 -15
- package/dist/components/opinly-blog.js.map +1 -1
- package/dist/components/opinly-blog.mjs +33 -0
- package/dist/components/{opinly-blog.cjs.map → opinly-blog.mjs.map} +1 -1
- package/dist/components/post-preview.js +77 -41
- package/dist/components/post-preview.js.map +1 -1
- package/dist/components/post-preview.mjs +77 -0
- package/dist/components/post-preview.mjs.map +1 -0
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/utils/dates.js +26 -2
- package/dist/utils/dates.js.map +1 -1
- package/dist/utils/dates.mjs +9 -0
- package/dist/utils/{dates.cjs.map → dates.mjs.map} +1 -1
- package/dist/utils/generate-metadata.d.cts +5 -3
- package/dist/utils/generate-metadata.d.ts +5 -3
- package/dist/utils/generate-metadata.js +33 -9
- package/dist/utils/generate-metadata.js.map +1 -1
- package/dist/utils/generate-metadata.mjs +36 -0
- package/dist/utils/generate-metadata.mjs.map +1 -0
- package/dist/utils/merge.js +29 -5
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/merge.mjs +9 -0
- package/dist/utils/{merge.cjs.map → merge.mjs.map} +1 -1
- package/dist/utils/sdk-config.d.cts +1 -0
- package/dist/utils/sdk-config.d.ts +1 -0
- package/dist/utils/sdk-config.js +31 -4
- package/dist/utils/sdk-config.js.map +1 -1
- package/dist/utils/sdk-config.mjs +32 -0
- package/dist/utils/sdk-config.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/components/author-page/_helpers/json-ld.cjs +0 -2
- package/dist/components/author-page/index.cjs +0 -83
- package/dist/components/author-page/index.cjs.map +0 -1
- package/dist/components/authors-page/index.cjs +0 -105
- package/dist/components/blog-post/_components/content.cjs +0 -159
- package/dist/components/blog-post/_components/content.cjs.map +0 -1
- package/dist/components/blog-post/_components/faq.cjs +0 -39
- package/dist/components/blog-post/_components/share.cjs +0 -100
- package/dist/components/blog-post/_components/table-of-contents.cjs +0 -81
- package/dist/components/blog-post/_components/table-of-contents.cjs.map +0 -1
- package/dist/components/blog-post/_helpers/calc-reading-time.cjs +0 -2
- package/dist/components/blog-post/_helpers/extract-headings.cjs +0 -44
- package/dist/components/blog-post/_helpers/reading-time.cjs +0 -50
- 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/class-names.cjs +0 -17
- package/dist/components/blog-post/_types/class-names.cjs.map +0 -1
- package/dist/components/blog-post/index.cjs +0 -148
- package/dist/components/bread-crumbs.cjs +0 -60
- package/dist/components/folder-page/index.cjs +0 -61
- package/dist/components/home-page/folders.cjs +0 -98
- package/dist/components/home-page/index.cjs +0 -44
- package/dist/components/home-page/pagination.cjs +0 -91
- package/dist/components/home-page/top-posts.cjs +0 -52
- package/dist/components/not-found.cjs +0 -60
- package/dist/components/opinly-blog.cjs +0 -57
- package/dist/components/post-preview.cjs +0 -111
- package/dist/components/post-preview.cjs.map +0 -1
- package/dist/index.cjs +0 -23
- package/dist/index.cjs.map +0 -1
- package/dist/utils/dates.cjs +0 -33
- package/dist/utils/generate-metadata.cjs +0 -60
- package/dist/utils/generate-metadata.cjs.map +0 -1
- package/dist/utils/merge.cjs +0 -33
- package/dist/utils/sdk-config.cjs +0 -55
- package/dist/utils/sdk-config.cjs.map +0 -1
- /package/dist/components/author-page/_helpers/{json-ld.cjs.map → json-ld.mjs.map} +0 -0
- /package/dist/components/blog-post/_helpers/{calc-reading-time.cjs.map → calc-reading-time.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_components/table-of-contents.tsx"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { cn } from \"../../../utils/merge\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { extractHeadings } from \"../_helpers/extract-headings\";\nimport { Share } from \"./share\";\nimport Link from \"next/link\";\n\ntype TableOfContentsProps = {\n content: JSONContent;\n author: BlogPostRes[\"author\"] | null;\n post: BlogPostRes;\n};\n\nexport const TableOfContents = ({\n content,\n author,\n post,\n}: TableOfContentsProps) => {\n return (\n <aside className={cn(\"w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start\")}>\n {author && (\n <div className=\"w-full mb-6 border p-4 rounded-md text-sm\">\n <div className=\"flex items-center gap-3 mb-3\">\n {author.fileKey && (\n <Image\n src={`${opinlyConfig.imagesPrefix}/${author.fileKey}`}\n alt={author.name}\n width={48}\n height={48}\n className=\"rounded-full\"\n />\n )}\n <div>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-xs uppercase text-muted-foreground font-medium\"\n >\n {author.name}\n </Link>\n <div className=\"text-muted-foreground text-sm\">{author.bio}</div>\n </div>\n </div>\n </div>\n )}\n <Share post={post} />\n <div className=\"border-l-4 border-opinlyAccent pl-4 mb-4\">\n <h2 className=\"text-lg font-semibold mb-2\">TABLE OF CONTENTS</h2>\n <ul className=\"text-sm text-gray-700 space-y-1\">\n {(extractHeadings(content) || []).map((heading) => (\n <li key={heading.slug}>\n <a href={`#${heading.slug}`} className=\"hover:underline\">\n {heading.text}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </aside>\n );\n};\n"],"mappings":"AA0Bc
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_components/table-of-contents.tsx"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { cn } from \"../../../utils/merge\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { extractHeadings } from \"../_helpers/extract-headings\";\nimport { Share } from \"./share\";\nimport Link from \"next/link\";\n\ntype TableOfContentsProps = {\n content: JSONContent;\n author: BlogPostRes[\"author\"] | null;\n post: BlogPostRes;\n};\n\nexport const TableOfContents = ({\n content,\n author,\n post,\n}: TableOfContentsProps) => {\n return (\n <aside className={cn(\"w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start\")}>\n {author && (\n <div className=\"w-full mb-6 border p-4 rounded-md text-sm\">\n <div className=\"flex items-center gap-3 mb-3\">\n {author.fileKey && (\n <Image\n unoptimized={opinlyConfig.unoptimizedImages}\n src={`${opinlyConfig.imagesPrefix}/${author.fileKey}`}\n alt={author.name}\n width={48}\n height={48}\n className=\"rounded-full\"\n />\n )}\n <div>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-xs uppercase text-muted-foreground font-medium\"\n >\n {author.name}\n </Link>\n <div className=\"text-muted-foreground text-sm\">{author.bio}</div>\n </div>\n </div>\n </div>\n )}\n <Share post={post} />\n <div className=\"border-l-4 border-opinlyAccent pl-4 mb-4\">\n <h2 className=\"text-lg font-semibold mb-2\">TABLE OF CONTENTS</h2>\n <ul className=\"text-sm text-gray-700 space-y-1\">\n {(extractHeadings(content) || []).map((heading) => (\n <li key={heading.slug}>\n <a href={`#${heading.slug}`} className=\"hover:underline\">\n {heading.text}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </aside>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA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|
+
import Image from "next/image";
|
|
4
|
+
import { opinlyConfig } from "../../../utils/sdk-config";
|
|
5
|
+
import { extractHeadings } from "../_helpers/extract-headings";
|
|
6
|
+
import { Share } from "./share";
|
|
7
|
+
import Link from "next/link";
|
|
8
|
+
const TableOfContents = ({
|
|
9
|
+
content,
|
|
10
|
+
author,
|
|
11
|
+
post
|
|
12
|
+
}) => {
|
|
13
|
+
return /* @__PURE__ */ jsxs("aside", { className: cn("w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start"), children: [
|
|
14
|
+
author && /* @__PURE__ */ jsx("div", { className: "w-full mb-6 border p-4 rounded-md text-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-3", children: [
|
|
15
|
+
author.fileKey && /* @__PURE__ */ jsx(
|
|
16
|
+
Image,
|
|
17
|
+
{
|
|
18
|
+
unoptimized: opinlyConfig.unoptimizedImages,
|
|
19
|
+
src: `${opinlyConfig.imagesPrefix}/${author.fileKey}`,
|
|
20
|
+
alt: author.name,
|
|
21
|
+
width: 48,
|
|
22
|
+
height: 48,
|
|
23
|
+
className: "rounded-full"
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
Link,
|
|
29
|
+
{
|
|
30
|
+
href: `${opinlyConfig.blogPrefix}/authors/${author.slug}`,
|
|
31
|
+
className: "text-xs uppercase text-muted-foreground font-medium",
|
|
32
|
+
children: author.name
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-sm", children: author.bio })
|
|
36
|
+
] })
|
|
37
|
+
] }) }),
|
|
38
|
+
/* @__PURE__ */ jsx(Share, { post }),
|
|
39
|
+
/* @__PURE__ */ jsxs("div", { className: "border-l-4 border-opinlyAccent pl-4 mb-4", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-2", children: "TABLE OF CONTENTS" }),
|
|
41
|
+
/* @__PURE__ */ jsx("ul", { className: "text-sm text-gray-700 space-y-1", children: (extractHeadings(content) || []).map((heading) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: `#${heading.slug}`, className: "hover:underline", children: heading.text }) }, heading.slug)) })
|
|
42
|
+
] })
|
|
43
|
+
] });
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
TableOfContents
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=table-of-contents.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_components/table-of-contents.tsx"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { cn } from \"../../../utils/merge\";\nimport Image from \"next/image\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { extractHeadings } from \"../_helpers/extract-headings\";\nimport { Share } from \"./share\";\nimport Link from \"next/link\";\n\ntype TableOfContentsProps = {\n content: JSONContent;\n author: BlogPostRes[\"author\"] | null;\n post: BlogPostRes;\n};\n\nexport const TableOfContents = ({\n content,\n author,\n post,\n}: TableOfContentsProps) => {\n return (\n <aside className={cn(\"w-full lg:w-1/3 lg:sticky lg:top-20 lg:self-start\")}>\n {author && (\n <div className=\"w-full mb-6 border p-4 rounded-md text-sm\">\n <div className=\"flex items-center gap-3 mb-3\">\n {author.fileKey && (\n <Image\n unoptimized={opinlyConfig.unoptimizedImages}\n src={`${opinlyConfig.imagesPrefix}/${author.fileKey}`}\n alt={author.name}\n width={48}\n height={48}\n className=\"rounded-full\"\n />\n )}\n <div>\n <Link\n href={`${opinlyConfig.blogPrefix}/authors/${author.slug}`}\n className=\"text-xs uppercase text-muted-foreground font-medium\"\n >\n {author.name}\n </Link>\n <div className=\"text-muted-foreground text-sm\">{author.bio}</div>\n </div>\n </div>\n </div>\n )}\n <Share post={post} />\n <div className=\"border-l-4 border-opinlyAccent pl-4 mb-4\">\n <h2 className=\"text-lg font-semibold mb-2\">TABLE OF CONTENTS</h2>\n <ul className=\"text-sm text-gray-700 space-y-1\">\n {(extractHeadings(content) || []).map((heading) => (\n <li key={heading.slug}>\n <a href={`#${heading.slug}`} className=\"hover:underline\">\n {heading.text}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </aside>\n );\n};\n"],"mappings":"AA0Bc,cASF,YATE;AAxBd,SAAS,UAAU;AACnB,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,OAAO,UAAU;AAQV,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,MAA4B;AAC1B,SACE,qBAAC,WAAM,WAAW,GAAG,mDAAmD,GACrE;AAAA,cACC,oBAAC,SAAI,WAAU,6CACb,+BAAC,SAAI,WAAU,gCACZ;AAAA,aAAO,WACN;AAAA,QAAC;AAAA;AAAA,UACC,aAAa,aAAa;AAAA,UAC1B,KAAK,GAAG,aAAa,YAAY,IAAI,OAAO,OAAO;AAAA,UACnD,KAAK,OAAO;AAAA,UACZ,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAU;AAAA;AAAA,MACZ;AAAA,MAEF,qBAAC,SACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,GAAG,aAAa,UAAU,YAAY,OAAO,IAAI;AAAA,YACvD,WAAU;AAAA,YAET,iBAAO;AAAA;AAAA,QACV;AAAA,QACA,oBAAC,SAAI,WAAU,iCAAiC,iBAAO,KAAI;AAAA,SAC7D;AAAA,OACF,GACF;AAAA,IAEF,oBAAC,SAAM,MAAY;AAAA,IACnB,qBAAC,SAAI,WAAU,4CACb;AAAA,0BAAC,QAAG,WAAU,8BAA6B,+BAAiB;AAAA,MAC5D,oBAAC,QAAG,WAAU,mCACV,2BAAgB,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,YACrC,oBAAC,QACC,8BAAC,OAAE,MAAM,IAAI,QAAQ,IAAI,IAAI,WAAU,mBACpC,kBAAQ,MACX,KAHO,QAAQ,IAIjB,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=calc-reading-time.mjs.map
|
|
@@ -1,3 +1,26 @@
|
|
|
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 extract_headings_exports = {};
|
|
20
|
+
__export(extract_headings_exports, {
|
|
21
|
+
extractHeadings: () => extractHeadings
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(extract_headings_exports);
|
|
1
24
|
function extractHeadings(content) {
|
|
2
25
|
const headings = [];
|
|
3
26
|
if (!content?.content) return headings;
|
|
@@ -14,7 +37,8 @@ function extractHeadings(content) {
|
|
|
14
37
|
walk(content.content);
|
|
15
38
|
return headings;
|
|
16
39
|
}
|
|
17
|
-
export
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
18
42
|
extractHeadings
|
|
19
|
-
};
|
|
43
|
+
});
|
|
20
44
|
//# sourceMappingURL=extract-headings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/extract-headings.ts"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\n\nexport function extractHeadings(\n content: JSONContent\n): { text: string; slug: string }[] {\n const headings: { text: string; slug: string }[] = [];\n if (!content?.content) return headings;\n\n const walk = (nodes: any[]) => {\n for (const node of nodes) {\n if (node.type === \"heading\" && node.content?.[0]?.text) {\n const text = node.content[0].text;\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n headings.push({ text, slug });\n }\n if (node.content) walk(node.content);\n }\n };\n\n walk(content.content);\n return headings;\n}\n"],"mappings":"AAEO,SAAS,gBACd,SACkC;AAClC,QAAM,WAA6C,CAAC;AACpD,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,QAAM,OAAO,CAAC,UAAiB;AAC7B,eAAW,QAAQ,OAAO;AACxB,UAAI,KAAK,SAAS,aAAa,KAAK,UAAU,CAAC,GAAG,MAAM;AACtD,cAAM,OAAO,KAAK,QAAQ,CAAC,EAAE;AAC7B,cAAM,OAAO,KACV,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AACzB,iBAAS,KAAK,EAAE,MAAM,KAAK,CAAC;AAAA,MAC9B;AACA,UAAI,KAAK,QAAS,MAAK,KAAK,OAAO;AAAA,IACrC;AAAA,EACF;AAEA,OAAK,QAAQ,OAAO;AACpB,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/extract-headings.ts"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\n\nexport function extractHeadings(\n content: JSONContent\n): { text: string; slug: string }[] {\n const headings: { text: string; slug: string }[] = [];\n if (!content?.content) return headings;\n\n const walk = (nodes: any[]) => {\n for (const node of nodes) {\n if (node.type === \"heading\" && node.content?.[0]?.text) {\n const text = node.content[0].text;\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n headings.push({ text, slug });\n }\n if (node.content) walk(node.content);\n }\n };\n\n walk(content.content);\n return headings;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,gBACd,SACkC;AAClC,QAAM,WAA6C,CAAC;AACpD,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,QAAM,OAAO,CAAC,UAAiB;AAC7B,eAAW,QAAQ,OAAO;AACxB,UAAI,KAAK,SAAS,aAAa,KAAK,UAAU,CAAC,GAAG,MAAM;AACtD,cAAM,OAAO,KAAK,QAAQ,CAAC,EAAE;AAC7B,cAAM,OAAO,KACV,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AACzB,iBAAS,KAAK,EAAE,MAAM,KAAK,CAAC;AAAA,MAC9B;AACA,UAAI,KAAK,QAAS,MAAK,KAAK,OAAO;AAAA,IACrC;AAAA,EACF;AAEA,OAAK,QAAQ,OAAO;AACpB,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function extractHeadings(content) {
|
|
2
|
+
const headings = [];
|
|
3
|
+
if (!content?.content) return headings;
|
|
4
|
+
const walk = (nodes) => {
|
|
5
|
+
for (const node of nodes) {
|
|
6
|
+
if (node.type === "heading" && node.content?.[0]?.text) {
|
|
7
|
+
const text = node.content[0].text;
|
|
8
|
+
const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
9
|
+
headings.push({ text, slug });
|
|
10
|
+
}
|
|
11
|
+
if (node.content) walk(node.content);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
walk(content.content);
|
|
15
|
+
return headings;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
extractHeadings
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=extract-headings.mjs.map
|
package/dist/components/blog-post/_helpers/{extract-headings.cjs.map → extract-headings.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/extract-headings.ts"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\n\nexport function extractHeadings(\n content: JSONContent\n): { text: string; slug: string }[] {\n const headings: { text: string; slug: string }[] = [];\n if (!content?.content) return headings;\n\n const walk = (nodes: any[]) => {\n for (const node of nodes) {\n if (node.type === \"heading\" && node.content?.[0]?.text) {\n const text = node.content[0].text;\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n headings.push({ text, slug });\n }\n if (node.content) walk(node.content);\n }\n };\n\n walk(content.content);\n return headings;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/extract-headings.ts"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\n\nexport function extractHeadings(\n content: JSONContent\n): { text: string; slug: string }[] {\n const headings: { text: string; slug: string }[] = [];\n if (!content?.content) return headings;\n\n const walk = (nodes: any[]) => {\n for (const node of nodes) {\n if (node.type === \"heading\" && node.content?.[0]?.text) {\n const text = node.content[0].text;\n const slug = text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n headings.push({ text, slug });\n }\n if (node.content) walk(node.content);\n }\n };\n\n walk(content.content);\n return headings;\n}\n"],"mappings":"AAEO,SAAS,gBACd,SACkC;AAClC,QAAM,WAA6C,CAAC;AACpD,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,QAAM,OAAO,CAAC,UAAiB;AAC7B,eAAW,QAAQ,OAAO;AACxB,UAAI,KAAK,SAAS,aAAa,KAAK,UAAU,CAAC,GAAG,MAAM;AACtD,cAAM,OAAO,KAAK,QAAQ,CAAC,EAAE;AAC7B,cAAM,OAAO,KACV,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AACzB,iBAAS,KAAK,EAAE,MAAM,KAAK,CAAC;AAAA,MAC9B;AACA,UAAI,KAAK,QAAS,MAAK,KAAK,OAAO;AAAA,IACrC;AAAA,EACF;AAEA,OAAK,QAAQ,OAAO;AACpB,SAAO;AACT;","names":[]}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
|
|
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
|
+
genBlogPostingJSONLD: () => genBlogPostingJSONLD,
|
|
22
|
+
genBreadcrumbJSONLD: () => genBreadcrumbJSONLD,
|
|
23
|
+
genFaqJSONLD: () => genFaqJSONLD,
|
|
24
|
+
generateArticleBodyHtml: () => generateArticleBodyHtml
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(json_ld_exports);
|
|
27
|
+
var import_sdk_config = require("../../../utils/sdk-config");
|
|
2
28
|
function generateArticleBodyHtml(content) {
|
|
3
29
|
if (!content?.content) return "";
|
|
4
30
|
let htmlString = "";
|
|
@@ -74,17 +100,17 @@ const genBlogPostingJSONLD = (post) => {
|
|
|
74
100
|
"@type": "BlogPosting",
|
|
75
101
|
headline: post.title,
|
|
76
102
|
description: post.description || void 0,
|
|
77
|
-
url: `${opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + "/"}${post.slug}` : post.slug}`,
|
|
103
|
+
url: `${import_sdk_config.opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + "/"}${post.slug}` : post.slug}`,
|
|
78
104
|
datePublished: post.firstPublishedAt || void 0,
|
|
79
105
|
dateModified: post.modifiedAt || void 0,
|
|
80
106
|
image: post.titleFile?.fileKey ? {
|
|
81
107
|
"@type": "ImageObject",
|
|
82
|
-
url: `${opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`
|
|
108
|
+
url: `${import_sdk_config.opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`
|
|
83
109
|
} : void 0,
|
|
84
110
|
author: post.author ? {
|
|
85
111
|
"@type": "Person",
|
|
86
112
|
name: post.author.name,
|
|
87
|
-
url: `${opinlyConfig.blogUrl}/author/${post.author.slug}`,
|
|
113
|
+
url: `${import_sdk_config.opinlyConfig.blogUrl}/author/${post.author.slug}`,
|
|
88
114
|
description: post.author.bio || void 0
|
|
89
115
|
} : void 0,
|
|
90
116
|
isAccessibleForFree: true,
|
|
@@ -97,13 +123,13 @@ const genBreadcrumbJSONLD = (post) => {
|
|
|
97
123
|
"@type": "ListItem",
|
|
98
124
|
position: 1,
|
|
99
125
|
name: "Company Name",
|
|
100
|
-
item: opinlyConfig.siteUrl
|
|
126
|
+
item: import_sdk_config.opinlyConfig.siteUrl
|
|
101
127
|
},
|
|
102
128
|
{
|
|
103
129
|
"@type": "ListItem",
|
|
104
130
|
position: 2,
|
|
105
131
|
name: post.folder?.name || "Blog",
|
|
106
|
-
item: `${opinlyConfig.blogUrl}/blog`
|
|
132
|
+
item: `${import_sdk_config.opinlyConfig.blogUrl}/blog`
|
|
107
133
|
}
|
|
108
134
|
];
|
|
109
135
|
if (post.folder) {
|
|
@@ -111,20 +137,20 @@ const genBreadcrumbJSONLD = (post) => {
|
|
|
111
137
|
"@type": "ListItem",
|
|
112
138
|
position: 3,
|
|
113
139
|
name: post.folder.name,
|
|
114
|
-
item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}`
|
|
140
|
+
item: `${import_sdk_config.opinlyConfig.blogUrl}/blog/${post.folder.slug}`
|
|
115
141
|
});
|
|
116
142
|
itemListElement.push({
|
|
117
143
|
"@type": "ListItem",
|
|
118
144
|
position: 4,
|
|
119
145
|
name: post.title,
|
|
120
|
-
item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`
|
|
146
|
+
item: `${import_sdk_config.opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`
|
|
121
147
|
});
|
|
122
148
|
} else {
|
|
123
149
|
itemListElement.push({
|
|
124
150
|
"@type": "ListItem",
|
|
125
151
|
position: 3,
|
|
126
152
|
name: post.title,
|
|
127
|
-
item: `${opinlyConfig.blogUrl}/blog/${post.slug}`
|
|
153
|
+
item: `${import_sdk_config.opinlyConfig.blogUrl}/blog/${post.slug}`
|
|
128
154
|
});
|
|
129
155
|
}
|
|
130
156
|
return {
|
|
@@ -133,10 +159,11 @@ const genBreadcrumbJSONLD = (post) => {
|
|
|
133
159
|
itemListElement
|
|
134
160
|
};
|
|
135
161
|
};
|
|
136
|
-
export
|
|
162
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
163
|
+
0 && (module.exports = {
|
|
137
164
|
genBlogPostingJSONLD,
|
|
138
165
|
genBreadcrumbJSONLD,
|
|
139
166
|
genFaqJSONLD,
|
|
140
167
|
generateArticleBodyHtml
|
|
141
|
-
};
|
|
168
|
+
});
|
|
142
169
|
//# sourceMappingURL=json-ld.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/json-ld.ts"],"sourcesContent":["import {\n BlogPosting,\n BreadcrumbList,\n FAQPage,\n WithContext,\n ListItem,\n} from \"schema-dts\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { JSONContent } from \"@tiptap/core\";\n\n// Add this function somewhere in your BlogPost component file\nexport function generateArticleBodyHtml(content: JSONContent): string {\n if (!content?.content) return \"\";\n\n let htmlString = \"\";\n\n content.content.forEach((node) => {\n switch (node.type) {\n case \"paragraph\":\n htmlString += `<p>${generateChildrenHtml(node.content)}</p>`;\n break;\n case \"heading\":\n const headingLevel = node.attrs?.level || 1;\n htmlString += `<h${headingLevel}>${generateChildrenHtml(node.content)}</h${headingLevel}>`;\n break;\n case \"bulletList\":\n htmlString += `<ul>${generateChildrenHtml(node.content)}</ul>`;\n break;\n case \"orderedList\":\n htmlString += `<ol>${generateChildrenHtml(node.content)}</ol>`;\n break;\n case \"listItem\":\n htmlString += `<li>${generateChildrenHtml(node.content)}</li>`;\n break;\n // Add other node types if they contain text content relevant for articleBody\n // For images, you might just skip them or include an <img> tag if semantic\n // For example:\n // case \"image\":\n // if (node.attrs?.src) {\n // htmlString += `<img src=\"${replaceImageHostname(node.attrs.src, opinlyConfig.imagesPrefix)}\" alt=\"${node.attrs?.alt || ''}\" />`;\n // }\n // break;\n default:\n // Handle other block types or just ignore them for articleBody\n break;\n }\n });\n\n return htmlString;\n}\n\nfunction generateChildrenHtml(\n nodes: JSONContent[\"content\"] | undefined\n): string {\n if (!nodes) return \"\";\n\n let childrenHtml = \"\";\n nodes.forEach((child) => {\n if (child.type === \"text\") {\n let text = child.text || \"\";\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = `<strong>${text}</strong>`;\n if (mark.type === \"italic\") text = `<em>${text}</em>`;\n if (mark.type === \"link\" && mark.attrs?.href) {\n text = `<a href=\"${mark.attrs.href}\">${text}</a>`;\n }\n });\n }\n childrenHtml += text;\n }\n // If you have nested content within child nodes, you might need a recursive call here\n // For example, if a list item can contain paragraphs\n // if (child.content) {\n // childrenHtml += generateChildrenHtml(child.content);\n // }\n });\n return childrenHtml;\n}\n\nexport const genFaqJSONLD = (\n faqs: NonNullable<BlogPostRes[\"faqs\"]>\n): WithContext<FAQPage> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"FAQPage\",\n mainEntity: faqs.map((faq) => ({\n \"@type\": \"Question\",\n name: faq.question,\n acceptedAnswer: {\n \"@type\": \"Answer\",\n text: faq.answer,\n },\n })),\n };\n};\n\nexport const genBlogPostingJSONLD = (\n post: BlogPostRes\n): WithContext<BlogPosting> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BlogPosting\",\n headline: post.title,\n description: post.description || undefined,\n url: `${opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + \"/\"}${post.slug}` : post.slug}`,\n datePublished: post.firstPublishedAt || undefined,\n dateModified: post.modifiedAt || undefined,\n image: post.titleFile?.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`,\n }\n : undefined,\n author: post.author\n ? {\n \"@type\": \"Person\",\n name: post.author.name,\n url: `${opinlyConfig.blogUrl}/author/${post.author.slug}`,\n description: post.author.bio || undefined,\n }\n : undefined,\n isAccessibleForFree: true,\n articleBody: generateArticleBodyHtml(post.content as JSONContent),\n };\n};\n\nexport const genBreadcrumbJSONLD = (\n post: BlogPostRes\n): WithContext<BreadcrumbList> => {\n const itemListElement = [\n {\n \"@type\": \"ListItem\",\n position: 1,\n name: \"Company Name\",\n item: opinlyConfig.siteUrl,\n },\n {\n \"@type\": \"ListItem\",\n position: 2,\n name: post.folder?.name || \"Blog\",\n item: `${opinlyConfig.blogUrl}/blog`,\n },\n ];\n\n if (post.folder) {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.folder.name,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}`,\n });\n\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 4,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`,\n });\n } else {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.slug}`,\n });\n }\n\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BreadcrumbList\",\n itemListElement: itemListElement as ListItem[],\n };\n};\n"],"mappings":"AAQA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/json-ld.ts"],"sourcesContent":["import {\n BlogPosting,\n BreadcrumbList,\n FAQPage,\n WithContext,\n ListItem,\n} from \"schema-dts\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { JSONContent } from \"@tiptap/core\";\n\n// Add this function somewhere in your BlogPost component file\nexport function generateArticleBodyHtml(content: JSONContent): string {\n if (!content?.content) return \"\";\n\n let htmlString = \"\";\n\n content.content.forEach((node) => {\n switch (node.type) {\n case \"paragraph\":\n htmlString += `<p>${generateChildrenHtml(node.content)}</p>`;\n break;\n case \"heading\":\n const headingLevel = node.attrs?.level || 1;\n htmlString += `<h${headingLevel}>${generateChildrenHtml(node.content)}</h${headingLevel}>`;\n break;\n case \"bulletList\":\n htmlString += `<ul>${generateChildrenHtml(node.content)}</ul>`;\n break;\n case \"orderedList\":\n htmlString += `<ol>${generateChildrenHtml(node.content)}</ol>`;\n break;\n case \"listItem\":\n htmlString += `<li>${generateChildrenHtml(node.content)}</li>`;\n break;\n // Add other node types if they contain text content relevant for articleBody\n // For images, you might just skip them or include an <img> tag if semantic\n // For example:\n // case \"image\":\n // if (node.attrs?.src) {\n // htmlString += `<img src=\"${replaceImageHostname(node.attrs.src, opinlyConfig.imagesPrefix)}\" alt=\"${node.attrs?.alt || ''}\" />`;\n // }\n // break;\n default:\n // Handle other block types or just ignore them for articleBody\n break;\n }\n });\n\n return htmlString;\n}\n\nfunction generateChildrenHtml(\n nodes: JSONContent[\"content\"] | undefined\n): string {\n if (!nodes) return \"\";\n\n let childrenHtml = \"\";\n nodes.forEach((child) => {\n if (child.type === \"text\") {\n let text = child.text || \"\";\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = `<strong>${text}</strong>`;\n if (mark.type === \"italic\") text = `<em>${text}</em>`;\n if (mark.type === \"link\" && mark.attrs?.href) {\n text = `<a href=\"${mark.attrs.href}\">${text}</a>`;\n }\n });\n }\n childrenHtml += text;\n }\n // If you have nested content within child nodes, you might need a recursive call here\n // For example, if a list item can contain paragraphs\n // if (child.content) {\n // childrenHtml += generateChildrenHtml(child.content);\n // }\n });\n return childrenHtml;\n}\n\nexport const genFaqJSONLD = (\n faqs: NonNullable<BlogPostRes[\"faqs\"]>\n): WithContext<FAQPage> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"FAQPage\",\n mainEntity: faqs.map((faq) => ({\n \"@type\": \"Question\",\n name: faq.question,\n acceptedAnswer: {\n \"@type\": \"Answer\",\n text: faq.answer,\n },\n })),\n };\n};\n\nexport const genBlogPostingJSONLD = (\n post: BlogPostRes\n): WithContext<BlogPosting> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BlogPosting\",\n headline: post.title,\n description: post.description || undefined,\n url: `${opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + \"/\"}${post.slug}` : post.slug}`,\n datePublished: post.firstPublishedAt || undefined,\n dateModified: post.modifiedAt || undefined,\n image: post.titleFile?.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`,\n }\n : undefined,\n author: post.author\n ? {\n \"@type\": \"Person\",\n name: post.author.name,\n url: `${opinlyConfig.blogUrl}/author/${post.author.slug}`,\n description: post.author.bio || undefined,\n }\n : undefined,\n isAccessibleForFree: true,\n articleBody: generateArticleBodyHtml(post.content as JSONContent),\n };\n};\n\nexport const genBreadcrumbJSONLD = (\n post: BlogPostRes\n): WithContext<BreadcrumbList> => {\n const itemListElement = [\n {\n \"@type\": \"ListItem\",\n position: 1,\n name: \"Company Name\",\n item: opinlyConfig.siteUrl,\n },\n {\n \"@type\": \"ListItem\",\n position: 2,\n name: post.folder?.name || \"Blog\",\n item: `${opinlyConfig.blogUrl}/blog`,\n },\n ];\n\n if (post.folder) {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.folder.name,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}`,\n });\n\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 4,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`,\n });\n } else {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.slug}`,\n });\n }\n\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BreadcrumbList\",\n itemListElement: itemListElement as ListItem[],\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,wBAA6B;AAItB,SAAS,wBAAwB,SAA8B;AACpE,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,MAAI,aAAa;AAEjB,UAAQ,QAAQ,QAAQ,CAAC,SAAS;AAChC,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,sBAAc,MAAM,qBAAqB,KAAK,OAAO,CAAC;AACtD;AAAA,MACF,KAAK;AACH,cAAM,eAAe,KAAK,OAAO,SAAS;AAC1C,sBAAc,KAAK,YAAY,IAAI,qBAAqB,KAAK,OAAO,CAAC,MAAM,YAAY;AACvF;AAAA,MACF,KAAK;AACH,sBAAc,OAAO,qBAAqB,KAAK,OAAO,CAAC;AACvD;AAAA,MACF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AAU;AAAA,MACV,MAAM,KAAK;AAAA,MACX,MAAM,GAAG,+BAAa,OAAO,SAAS,KAAK,IAAI;AAAA,IACjD,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,SAAS;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
genBlogPostingJSONLD: () => genBlogPostingJSONLD,
|
|
22
|
-
genBreadcrumbJSONLD: () => genBreadcrumbJSONLD,
|
|
23
|
-
genFaqJSONLD: () => genFaqJSONLD,
|
|
24
|
-
generateArticleBodyHtml: () => generateArticleBodyHtml
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(json_ld_exports);
|
|
27
|
-
var import_sdk_config = require("../../../utils/sdk-config");
|
|
1
|
+
import { opinlyConfig } from "../../../utils/sdk-config";
|
|
28
2
|
function generateArticleBodyHtml(content) {
|
|
29
3
|
if (!content?.content) return "";
|
|
30
4
|
let htmlString = "";
|
|
@@ -100,17 +74,17 @@ const genBlogPostingJSONLD = (post) => {
|
|
|
100
74
|
"@type": "BlogPosting",
|
|
101
75
|
headline: post.title,
|
|
102
76
|
description: post.description || void 0,
|
|
103
|
-
url: `${
|
|
77
|
+
url: `${opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + "/"}${post.slug}` : post.slug}`,
|
|
104
78
|
datePublished: post.firstPublishedAt || void 0,
|
|
105
79
|
dateModified: post.modifiedAt || void 0,
|
|
106
80
|
image: post.titleFile?.fileKey ? {
|
|
107
81
|
"@type": "ImageObject",
|
|
108
|
-
url: `${
|
|
82
|
+
url: `${opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`
|
|
109
83
|
} : void 0,
|
|
110
84
|
author: post.author ? {
|
|
111
85
|
"@type": "Person",
|
|
112
86
|
name: post.author.name,
|
|
113
|
-
url: `${
|
|
87
|
+
url: `${opinlyConfig.blogUrl}/author/${post.author.slug}`,
|
|
114
88
|
description: post.author.bio || void 0
|
|
115
89
|
} : void 0,
|
|
116
90
|
isAccessibleForFree: true,
|
|
@@ -123,13 +97,13 @@ const genBreadcrumbJSONLD = (post) => {
|
|
|
123
97
|
"@type": "ListItem",
|
|
124
98
|
position: 1,
|
|
125
99
|
name: "Company Name",
|
|
126
|
-
item:
|
|
100
|
+
item: opinlyConfig.siteUrl
|
|
127
101
|
},
|
|
128
102
|
{
|
|
129
103
|
"@type": "ListItem",
|
|
130
104
|
position: 2,
|
|
131
105
|
name: post.folder?.name || "Blog",
|
|
132
|
-
item: `${
|
|
106
|
+
item: `${opinlyConfig.blogUrl}/blog`
|
|
133
107
|
}
|
|
134
108
|
];
|
|
135
109
|
if (post.folder) {
|
|
@@ -137,20 +111,20 @@ const genBreadcrumbJSONLD = (post) => {
|
|
|
137
111
|
"@type": "ListItem",
|
|
138
112
|
position: 3,
|
|
139
113
|
name: post.folder.name,
|
|
140
|
-
item: `${
|
|
114
|
+
item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}`
|
|
141
115
|
});
|
|
142
116
|
itemListElement.push({
|
|
143
117
|
"@type": "ListItem",
|
|
144
118
|
position: 4,
|
|
145
119
|
name: post.title,
|
|
146
|
-
item: `${
|
|
120
|
+
item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`
|
|
147
121
|
});
|
|
148
122
|
} else {
|
|
149
123
|
itemListElement.push({
|
|
150
124
|
"@type": "ListItem",
|
|
151
125
|
position: 3,
|
|
152
126
|
name: post.title,
|
|
153
|
-
item: `${
|
|
127
|
+
item: `${opinlyConfig.blogUrl}/blog/${post.slug}`
|
|
154
128
|
});
|
|
155
129
|
}
|
|
156
130
|
return {
|
|
@@ -159,11 +133,10 @@ const genBreadcrumbJSONLD = (post) => {
|
|
|
159
133
|
itemListElement
|
|
160
134
|
};
|
|
161
135
|
};
|
|
162
|
-
|
|
163
|
-
0 && (module.exports = {
|
|
136
|
+
export {
|
|
164
137
|
genBlogPostingJSONLD,
|
|
165
138
|
genBreadcrumbJSONLD,
|
|
166
139
|
genFaqJSONLD,
|
|
167
140
|
generateArticleBodyHtml
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=json-ld.
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=json-ld.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/json-ld.ts"],"sourcesContent":["import {\n BlogPosting,\n BreadcrumbList,\n FAQPage,\n WithContext,\n ListItem,\n} from \"schema-dts\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { JSONContent } from \"@tiptap/core\";\n\n// Add this function somewhere in your BlogPost component file\nexport function generateArticleBodyHtml(content: JSONContent): string {\n if (!content?.content) return \"\";\n\n let htmlString = \"\";\n\n content.content.forEach((node) => {\n switch (node.type) {\n case \"paragraph\":\n htmlString += `<p>${generateChildrenHtml(node.content)}</p>`;\n break;\n case \"heading\":\n const headingLevel = node.attrs?.level || 1;\n htmlString += `<h${headingLevel}>${generateChildrenHtml(node.content)}</h${headingLevel}>`;\n break;\n case \"bulletList\":\n htmlString += `<ul>${generateChildrenHtml(node.content)}</ul>`;\n break;\n case \"orderedList\":\n htmlString += `<ol>${generateChildrenHtml(node.content)}</ol>`;\n break;\n case \"listItem\":\n htmlString += `<li>${generateChildrenHtml(node.content)}</li>`;\n break;\n // Add other node types if they contain text content relevant for articleBody\n // For images, you might just skip them or include an <img> tag if semantic\n // For example:\n // case \"image\":\n // if (node.attrs?.src) {\n // htmlString += `<img src=\"${replaceImageHostname(node.attrs.src, opinlyConfig.imagesPrefix)}\" alt=\"${node.attrs?.alt || ''}\" />`;\n // }\n // break;\n default:\n // Handle other block types or just ignore them for articleBody\n break;\n }\n });\n\n return htmlString;\n}\n\nfunction generateChildrenHtml(\n nodes: JSONContent[\"content\"] | undefined\n): string {\n if (!nodes) return \"\";\n\n let childrenHtml = \"\";\n nodes.forEach((child) => {\n if (child.type === \"text\") {\n let text = child.text || \"\";\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = `<strong>${text}</strong>`;\n if (mark.type === \"italic\") text = `<em>${text}</em>`;\n if (mark.type === \"link\" && mark.attrs?.href) {\n text = `<a href=\"${mark.attrs.href}\">${text}</a>`;\n }\n });\n }\n childrenHtml += text;\n }\n // If you have nested content within child nodes, you might need a recursive call here\n // For example, if a list item can contain paragraphs\n // if (child.content) {\n // childrenHtml += generateChildrenHtml(child.content);\n // }\n });\n return childrenHtml;\n}\n\nexport const genFaqJSONLD = (\n faqs: NonNullable<BlogPostRes[\"faqs\"]>\n): WithContext<FAQPage> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"FAQPage\",\n mainEntity: faqs.map((faq) => ({\n \"@type\": \"Question\",\n name: faq.question,\n acceptedAnswer: {\n \"@type\": \"Answer\",\n text: faq.answer,\n },\n })),\n };\n};\n\nexport const genBlogPostingJSONLD = (\n post: BlogPostRes\n): WithContext<BlogPosting> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BlogPosting\",\n headline: post.title,\n description: post.description || undefined,\n url: `${opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + \"/\"}${post.slug}` : post.slug}`,\n datePublished: post.firstPublishedAt || undefined,\n dateModified: post.modifiedAt || undefined,\n image: post.titleFile?.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`,\n }\n : undefined,\n author: post.author\n ? {\n \"@type\": \"Person\",\n name: post.author.name,\n url: `${opinlyConfig.blogUrl}/author/${post.author.slug}`,\n description: post.author.bio || undefined,\n }\n : undefined,\n isAccessibleForFree: true,\n articleBody: generateArticleBodyHtml(post.content as JSONContent),\n };\n};\n\nexport const genBreadcrumbJSONLD = (\n post: BlogPostRes\n): WithContext<BreadcrumbList> => {\n const itemListElement = [\n {\n \"@type\": \"ListItem\",\n position: 1,\n name: \"Company Name\",\n item: opinlyConfig.siteUrl,\n },\n {\n \"@type\": \"ListItem\",\n position: 2,\n name: post.folder?.name || \"Blog\",\n item: `${opinlyConfig.blogUrl}/blog`,\n },\n ];\n\n if (post.folder) {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.folder.name,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}`,\n });\n\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 4,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`,\n });\n } else {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.slug}`,\n });\n }\n\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BreadcrumbList\",\n itemListElement: itemListElement as ListItem[],\n };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/json-ld.ts"],"sourcesContent":["import {\n BlogPosting,\n BreadcrumbList,\n FAQPage,\n WithContext,\n ListItem,\n} from \"schema-dts\";\nimport { BlogPostRes } from \"../_types/blog-post\";\nimport { opinlyConfig } from \"../../../utils/sdk-config\";\nimport { JSONContent } from \"@tiptap/core\";\n\n// Add this function somewhere in your BlogPost component file\nexport function generateArticleBodyHtml(content: JSONContent): string {\n if (!content?.content) return \"\";\n\n let htmlString = \"\";\n\n content.content.forEach((node) => {\n switch (node.type) {\n case \"paragraph\":\n htmlString += `<p>${generateChildrenHtml(node.content)}</p>`;\n break;\n case \"heading\":\n const headingLevel = node.attrs?.level || 1;\n htmlString += `<h${headingLevel}>${generateChildrenHtml(node.content)}</h${headingLevel}>`;\n break;\n case \"bulletList\":\n htmlString += `<ul>${generateChildrenHtml(node.content)}</ul>`;\n break;\n case \"orderedList\":\n htmlString += `<ol>${generateChildrenHtml(node.content)}</ol>`;\n break;\n case \"listItem\":\n htmlString += `<li>${generateChildrenHtml(node.content)}</li>`;\n break;\n // Add other node types if they contain text content relevant for articleBody\n // For images, you might just skip them or include an <img> tag if semantic\n // For example:\n // case \"image\":\n // if (node.attrs?.src) {\n // htmlString += `<img src=\"${replaceImageHostname(node.attrs.src, opinlyConfig.imagesPrefix)}\" alt=\"${node.attrs?.alt || ''}\" />`;\n // }\n // break;\n default:\n // Handle other block types or just ignore them for articleBody\n break;\n }\n });\n\n return htmlString;\n}\n\nfunction generateChildrenHtml(\n nodes: JSONContent[\"content\"] | undefined\n): string {\n if (!nodes) return \"\";\n\n let childrenHtml = \"\";\n nodes.forEach((child) => {\n if (child.type === \"text\") {\n let text = child.text || \"\";\n if (child.marks) {\n child.marks.forEach((mark) => {\n if (mark.type === \"bold\") text = `<strong>${text}</strong>`;\n if (mark.type === \"italic\") text = `<em>${text}</em>`;\n if (mark.type === \"link\" && mark.attrs?.href) {\n text = `<a href=\"${mark.attrs.href}\">${text}</a>`;\n }\n });\n }\n childrenHtml += text;\n }\n // If you have nested content within child nodes, you might need a recursive call here\n // For example, if a list item can contain paragraphs\n // if (child.content) {\n // childrenHtml += generateChildrenHtml(child.content);\n // }\n });\n return childrenHtml;\n}\n\nexport const genFaqJSONLD = (\n faqs: NonNullable<BlogPostRes[\"faqs\"]>\n): WithContext<FAQPage> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"FAQPage\",\n mainEntity: faqs.map((faq) => ({\n \"@type\": \"Question\",\n name: faq.question,\n acceptedAnswer: {\n \"@type\": \"Answer\",\n text: faq.answer,\n },\n })),\n };\n};\n\nexport const genBlogPostingJSONLD = (\n post: BlogPostRes\n): WithContext<BlogPosting> => {\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BlogPosting\",\n headline: post.title,\n description: post.description || undefined,\n url: `${opinlyConfig.blogUrl}/${post.folder ? `${post.folder.slug + \"/\"}${post.slug}` : post.slug}`,\n datePublished: post.firstPublishedAt || undefined,\n dateModified: post.modifiedAt || undefined,\n image: post.titleFile?.fileKey\n ? {\n \"@type\": \"ImageObject\",\n url: `${opinlyConfig.imagesUrl}/${post.titleFile.fileKey}`,\n }\n : undefined,\n author: post.author\n ? {\n \"@type\": \"Person\",\n name: post.author.name,\n url: `${opinlyConfig.blogUrl}/author/${post.author.slug}`,\n description: post.author.bio || undefined,\n }\n : undefined,\n isAccessibleForFree: true,\n articleBody: generateArticleBodyHtml(post.content as JSONContent),\n };\n};\n\nexport const genBreadcrumbJSONLD = (\n post: BlogPostRes\n): WithContext<BreadcrumbList> => {\n const itemListElement = [\n {\n \"@type\": \"ListItem\",\n position: 1,\n name: \"Company Name\",\n item: opinlyConfig.siteUrl,\n },\n {\n \"@type\": \"ListItem\",\n position: 2,\n name: post.folder?.name || \"Blog\",\n item: `${opinlyConfig.blogUrl}/blog`,\n },\n ];\n\n if (post.folder) {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.folder.name,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}`,\n });\n\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 4,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.folder.slug}/${post.slug}`,\n });\n } else {\n itemListElement.push({\n \"@type\": \"ListItem\",\n position: 3,\n name: post.title,\n item: `${opinlyConfig.blogUrl}/blog/${post.slug}`,\n });\n }\n\n return {\n \"@context\": \"https://schema.org\",\n \"@type\": \"BreadcrumbList\",\n itemListElement: itemListElement as ListItem[],\n };\n};\n"],"mappings":"AAQA,SAAS,oBAAoB;AAItB,SAAS,wBAAwB,SAA8B;AACpE,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,MAAI,aAAa;AAEjB,UAAQ,QAAQ,QAAQ,CAAC,SAAS;AAChC,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,sBAAc,MAAM,qBAAqB,KAAK,OAAO,CAAC;AACtD;AAAA,MACF,KAAK;AACH,cAAM,eAAe,KAAK,OAAO,SAAS;AAC1C,sBAAc,KAAK,YAAY,IAAI,qBAAqB,KAAK,OAAO,CAAC,MAAM,YAAY;AACvF;AAAA,MACF,KAAK;AACH,sBAAc,OAAO,qBAAqB,KAAK,OAAO,CAAC;AACvD;AAAA,MACF,KAAK;AACH,sBAAc,OAAO,qBAAqB,KAAK,OAAO,CAAC;AACvD;AAAA,MACF,KAAK;AACH,sBAAc,OAAO,qBAAqB,KAAK,OAAO,CAAC;AACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MASF;AAEE;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAEA,SAAS,qBACP,OACQ;AACR,MAAI,CAAC,MAAO,QAAO;AAEnB,MAAI,eAAe;AACnB,QAAM,QAAQ,CAAC,UAAU;AACvB,QAAI,MAAM,SAAS,QAAQ;AACzB,UAAI,OAAO,MAAM,QAAQ;AACzB,UAAI,MAAM,OAAO;AACf,cAAM,MAAM,QAAQ,CAAC,SAAS;AAC5B,cAAI,KAAK,SAAS,O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;AAAA,EAClE;AACF;AAEO,MAAM,sBAAsB,CACjC,SACgC;AAChC,QAAM,kBAAkB;AAAA,IACtB;AAAA,MACE,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM;AAAA,MACN,MAAM,aAAa;AAAA,IACrB;AAAA,IACA;AAAA,MACE,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM,KAAK,QAAQ,QAAQ;AAAA,MAC3B,MAAM,GAAG,aAAa,OAAO;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI,KAAK,QAAQ;AACf,oBAAgB,KAAK;AAAA,MACnB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM,KAAK,OAAO;AAAA,MAClB,MAAM,GAAG,aAAa,OAAO,SAAS,KAAK,OAAO,IAAI;AAAA,IACxD,CAAC;AAED,oBAAgB,KAAK;AAAA,MACnB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM,KAAK;AAAA,MACX,MAAM,GAAG,aAAa,OAAO,SAAS,KAAK,OAAO,IAAI,IAAI,KAAK,IAAI;AAAA,IACrE,CAAC;AAAA,EACH,OAAO;AACL,oBAAgB,KAAK;AAAA,MACnB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,MAAM,KAAK;AAAA,MACX,MAAM,GAAG,aAAa,OAAO,SAAS,KAAK,IAAI;AAAA,IACjD,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,SAAS;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,3 +1,27 @@
|
|
|
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 reading_time_exports = {};
|
|
20
|
+
__export(reading_time_exports, {
|
|
21
|
+
calculateReadingTime: () => calculateReadingTime,
|
|
22
|
+
countWords: () => countWords
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(reading_time_exports);
|
|
1
25
|
const countWords = (content) => {
|
|
2
26
|
if (!content?.content) return 0;
|
|
3
27
|
let wordCount = 0;
|
|
@@ -18,8 +42,9 @@ function calculateReadingTime(content) {
|
|
|
18
42
|
const readingTimeMinutes = Math.ceil(wordCount / 200);
|
|
19
43
|
return readingTimeMinutes;
|
|
20
44
|
}
|
|
21
|
-
export
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
22
47
|
calculateReadingTime,
|
|
23
48
|
countWords
|
|
24
|
-
};
|
|
49
|
+
});
|
|
25
50
|
//# sourceMappingURL=reading-time.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/reading-time.ts"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\n\nexport const countWords = (content: JSONContent | undefined): number => {\n if (!content?.content) return 0;\n\n let wordCount = 0;\n\n const countWords = (nodes: any[]) => {\n for (const node of nodes) {\n if (node.type === \"text\" && node.text) {\n const words = node.text.trim().split(/\\s+/).filter(Boolean);\n wordCount += words.length;\n }\n if (node.content) countWords(node.content);\n }\n };\n\n countWords(content.content);\n\n return wordCount;\n};\n\nexport function calculateReadingTime(content: JSONContent): number {\n const wordCount = countWords(content.content);\n\n const readingTimeMinutes = Math.ceil(wordCount / 200);\n return readingTimeMinutes;\n}\n"],"mappings":"AAEO,MAAM,aAAa,CAAC,YAA6C;AACtE,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,MAAI,YAAY;AAEhB,QAAMA,cAAa,CAAC,UAAiB;AACnC,eAAW,QAAQ,OAAO;AACxB,UAAI,KAAK,SAAS,UAAU,KAAK,MAAM;AACrC,cAAM,QAAQ,KAAK,KAAK,KAAK,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO;AAC1D,qBAAa,MAAM;AAAA,MACrB;AACA,UAAI,KAAK,QAAS,CAAAA,YAAW,KAAK,OAAO;AAAA,IAC3C;AAAA,EACF;AAEA,EAAAA,YAAW,QAAQ,OAAO;AAE1B,SAAO;AACT;AAEO,SAAS,qBAAqB,SAA8B;AACjE,QAAM,YAAY,WAAW,QAAQ,OAAO;AAE5C,QAAM,qBAAqB,KAAK,KAAK,YAAY,GAAG;AACpD,SAAO;AACT;","names":["countWords"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/reading-time.ts"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\n\nexport const countWords = (content: JSONContent | undefined): number => {\n if (!content?.content) return 0;\n\n let wordCount = 0;\n\n const countWords = (nodes: any[]) => {\n for (const node of nodes) {\n if (node.type === \"text\" && node.text) {\n const words = node.text.trim().split(/\\s+/).filter(Boolean);\n wordCount += words.length;\n }\n if (node.content) countWords(node.content);\n }\n };\n\n countWords(content.content);\n\n return wordCount;\n};\n\nexport function calculateReadingTime(content: JSONContent): number {\n const wordCount = countWords(content.content);\n\n const readingTimeMinutes = Math.ceil(wordCount / 200);\n return readingTimeMinutes;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,aAAa,CAAC,YAA6C;AACtE,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,MAAI,YAAY;AAEhB,QAAMA,cAAa,CAAC,UAAiB;AACnC,eAAW,QAAQ,OAAO;AACxB,UAAI,KAAK,SAAS,UAAU,KAAK,MAAM;AACrC,cAAM,QAAQ,KAAK,KAAK,KAAK,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO;AAC1D,qBAAa,MAAM;AAAA,MACrB;AACA,UAAI,KAAK,QAAS,CAAAA,YAAW,KAAK,OAAO;AAAA,IAC3C;AAAA,EACF;AAEA,EAAAA,YAAW,QAAQ,OAAO;AAE1B,SAAO;AACT;AAEO,SAAS,qBAAqB,SAA8B;AACjE,QAAM,YAAY,WAAW,QAAQ,OAAO;AAE5C,QAAM,qBAAqB,KAAK,KAAK,YAAY,GAAG;AACpD,SAAO;AACT;","names":["countWords"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const countWords = (content) => {
|
|
2
|
+
if (!content?.content) return 0;
|
|
3
|
+
let wordCount = 0;
|
|
4
|
+
const countWords2 = (nodes) => {
|
|
5
|
+
for (const node of nodes) {
|
|
6
|
+
if (node.type === "text" && node.text) {
|
|
7
|
+
const words = node.text.trim().split(/\s+/).filter(Boolean);
|
|
8
|
+
wordCount += words.length;
|
|
9
|
+
}
|
|
10
|
+
if (node.content) countWords2(node.content);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
countWords2(content.content);
|
|
14
|
+
return wordCount;
|
|
15
|
+
};
|
|
16
|
+
function calculateReadingTime(content) {
|
|
17
|
+
const wordCount = countWords(content.content);
|
|
18
|
+
const readingTimeMinutes = Math.ceil(wordCount / 200);
|
|
19
|
+
return readingTimeMinutes;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
calculateReadingTime,
|
|
23
|
+
countWords
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=reading-time.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/reading-time.ts"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\n\nexport const countWords = (content: JSONContent | undefined): number => {\n if (!content?.content) return 0;\n\n let wordCount = 0;\n\n const countWords = (nodes: any[]) => {\n for (const node of nodes) {\n if (node.type === \"text\" && node.text) {\n const words = node.text.trim().split(/\\s+/).filter(Boolean);\n wordCount += words.length;\n }\n if (node.content) countWords(node.content);\n }\n };\n\n countWords(content.content);\n\n return wordCount;\n};\n\nexport function calculateReadingTime(content: JSONContent): number {\n const wordCount = countWords(content.content);\n\n const readingTimeMinutes = Math.ceil(wordCount / 200);\n return readingTimeMinutes;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_helpers/reading-time.ts"],"sourcesContent":["import { JSONContent } from \"@tiptap/core\";\n\nexport const countWords = (content: JSONContent | undefined): number => {\n if (!content?.content) return 0;\n\n let wordCount = 0;\n\n const countWords = (nodes: any[]) => {\n for (const node of nodes) {\n if (node.type === \"text\" && node.text) {\n const words = node.text.trim().split(/\\s+/).filter(Boolean);\n wordCount += words.length;\n }\n if (node.content) countWords(node.content);\n }\n };\n\n countWords(content.content);\n\n return wordCount;\n};\n\nexport function calculateReadingTime(content: JSONContent): number {\n const wordCount = countWords(content.content);\n\n const readingTimeMinutes = Math.ceil(wordCount / 200);\n return readingTimeMinutes;\n}\n"],"mappings":"AAEO,MAAM,aAAa,CAAC,YAA6C;AACtE,MAAI,CAAC,SAAS,QAAS,QAAO;AAE9B,MAAI,YAAY;AAEhB,QAAMA,cAAa,CAAC,UAAiB;AACnC,eAAW,QAAQ,OAAO;AACxB,UAAI,KAAK,SAAS,UAAU,KAAK,MAAM;AACrC,cAAM,QAAQ,KAAK,KAAK,KAAK,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO;AAC1D,qBAAa,MAAM;AAAA,MACrB;AACA,UAAI,KAAK,QAAS,CAAAA,YAAW,KAAK,OAAO;AAAA,IAC3C;AAAA,EACF;AAEA,EAAAA,YAAW,QAAQ,OAAO;AAE1B,SAAO;AACT;AAEO,SAAS,qBAAqB,SAA8B;AACjE,QAAM,YAAY,WAAW,QAAQ,OAAO;AAE5C,QAAM,qBAAqB,KAAK,KAAK,YAAY,GAAG;AACpD,SAAO;AACT;","names":["countWords"]}
|
|
@@ -1 +1,17 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var blog_post_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(blog_post_exports);
|
|
1
17
|
//# sourceMappingURL=blog-post.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_types/blog-post.ts"],"sourcesContent":["import type { Opinly } from \"@opinly/backend\";\n\nexport type BlogPostRes = Extract<\n Awaited<ReturnType<Opinly[\"content\"][\"blog\"]>>,\n { type: \"post\" }\n>[\"data\"];\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=blog-post.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +1,17 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var class_names_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(class_names_exports);
|
|
1
17
|
//# sourceMappingURL=class-names.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/blog-post/_types/class-names.ts"],"sourcesContent":["export type BlogComponentClassNames = {\n paragraph?: string;\n heading?: string;\n image?: string;\n bulletList?: string;\n orderedList?: string;\n listItem?: string;\n link?: string;\n container?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=class-names.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|