@sonordev/site-kit 2.2.9 → 2.5.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/blog/index.d.mts +31 -3
- package/dist/blog/index.d.ts +31 -3
- package/dist/blog/index.js +194 -10
- package/dist/blog/index.js.map +1 -1
- package/dist/blog/index.mjs +183 -4
- package/dist/blog/index.mjs.map +1 -1
- package/dist/blog/server-ui.d.mts +1 -1
- package/dist/blog/server-ui.d.ts +1 -1
- package/dist/blog/server-ui.js +3 -3
- package/dist/blog/server-ui.mjs +1 -1
- package/dist/blog/server.d.mts +79 -7
- package/dist/blog/server.d.ts +79 -7
- package/dist/blog/server.js +64 -32
- package/dist/blog/server.mjs +1 -1
- package/dist/{chunk-WRCX2NKY.mjs → chunk-2NM6RGAV.mjs} +226 -22
- package/dist/chunk-2NM6RGAV.mjs.map +1 -0
- package/dist/chunk-5B4FABFK.js +28 -0
- package/dist/chunk-5B4FABFK.js.map +1 -0
- package/dist/{chunk-DTVZJPVM.mjs → chunk-5SQ4NRPH.mjs} +9 -2
- package/dist/chunk-5SQ4NRPH.mjs.map +1 -0
- package/dist/chunk-ATG4FJY6.js +76 -0
- package/dist/chunk-ATG4FJY6.js.map +1 -0
- package/dist/{chunk-GQKBGL2W.js → chunk-DZKX3GHL.js} +233 -21
- package/dist/chunk-DZKX3GHL.js.map +1 -0
- package/dist/{chunk-LNMI6OMN.js → chunk-F54HGPDM.js} +137 -4
- package/dist/chunk-F54HGPDM.js.map +1 -0
- package/dist/chunk-H23ZT2I2.mjs +67 -0
- package/dist/chunk-H23ZT2I2.mjs.map +1 -0
- package/dist/chunk-H4OBGC43.mjs +26 -0
- package/dist/chunk-H4OBGC43.mjs.map +1 -0
- package/dist/{chunk-Z6EHHJWU.mjs → chunk-MNOVPHL6.mjs} +230 -35
- package/dist/chunk-MNOVPHL6.mjs.map +1 -0
- package/dist/{chunk-ITPVKQB6.js → chunk-MWE2HRPU.js} +229 -34
- package/dist/chunk-MWE2HRPU.js.map +1 -0
- package/dist/{chunk-AWMEH65F.js → chunk-PAF5IGGF.js} +9 -2
- package/dist/chunk-PAF5IGGF.js.map +1 -0
- package/dist/{chunk-OOZCN7AF.mjs → chunk-T5UU7I4V.mjs} +137 -5
- package/dist/chunk-T5UU7I4V.mjs.map +1 -0
- package/dist/cli/index.js +352 -78
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +352 -78
- package/dist/cli/index.mjs.map +1 -1
- package/dist/config/index.d.mts +17 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.js +43 -3
- package/dist/config/index.js.map +1 -1
- package/dist/config/index.mjs +43 -3
- package/dist/config/index.mjs.map +1 -1
- package/dist/forms/index.js +3 -1
- package/dist/forms/index.js.map +1 -1
- package/dist/forms/index.mjs +3 -1
- package/dist/forms/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/layout/index.d.mts +6 -1
- package/dist/layout/index.d.ts +6 -1
- package/dist/layout/index.js +7 -3
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/index.mjs +7 -3
- package/dist/layout/index.mjs.map +1 -1
- package/dist/llms/contract.d.mts +43 -0
- package/dist/llms/contract.d.ts +43 -0
- package/dist/llms/contract.js +41 -0
- package/dist/llms/contract.js.map +1 -0
- package/dist/llms/contract.mjs +4 -0
- package/dist/llms/contract.mjs.map +1 -0
- package/dist/llms/index.d.mts +67 -5
- package/dist/llms/index.d.ts +67 -5
- package/dist/llms/index.js +154 -36
- package/dist/llms/index.js.map +1 -1
- package/dist/llms/index.mjs +107 -27
- package/dist/llms/index.mjs.map +1 -1
- package/dist/middleware/index.d.mts +13 -1
- package/dist/middleware/index.d.ts +13 -1
- package/dist/middleware/index.js +11 -0
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +11 -0
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/{routing-ccNYbFLU.d.ts → routing-C7gmHWm9.d.ts} +1 -1
- package/dist/{routing-ebQln7wH.d.mts → routing-trNzR1Pz.d.mts} +1 -1
- package/dist/seo/index.d.mts +19 -4
- package/dist/seo/index.d.ts +19 -4
- package/dist/seo/index.js +49 -14
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/index.mjs +42 -8
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo/server.d.mts +2 -2
- package/dist/seo/server.d.ts +2 -2
- package/dist/seo/server.js +5 -5
- package/dist/seo/server.mjs +1 -1
- package/dist/sitemap/index.d.mts +8 -1
- package/dist/sitemap/index.d.ts +8 -1
- package/dist/sitemap/index.js +24 -4
- package/dist/sitemap/index.js.map +1 -1
- package/dist/sitemap/index.mjs +23 -3
- package/dist/sitemap/index.mjs.map +1 -1
- package/dist/{types-BxzT7yhf.d.mts → types-0NuBL1Gg.d.ts} +34 -0
- package/dist/{types-DWMpAtGy.d.mts → types-5P5B9RgV.d.mts} +57 -1
- package/dist/{types-DWMpAtGy.d.ts → types-5P5B9RgV.d.ts} +57 -1
- package/dist/{types-CGkyylOa.d.mts → types-DYyIAgQg.d.mts} +2 -0
- package/dist/{types-CGkyylOa.d.ts → types-DYyIAgQg.d.ts} +2 -0
- package/dist/{types-BxzT7yhf.d.ts → types-J7Z_FqmV.d.mts} +34 -0
- package/package.json +15 -1
- package/scripts/postinstall.cjs +67 -0
- package/dist/chunk-AWMEH65F.js.map +0 -1
- package/dist/chunk-DTVZJPVM.mjs.map +0 -1
- package/dist/chunk-GQKBGL2W.js.map +0 -1
- package/dist/chunk-ITPVKQB6.js.map +0 -1
- package/dist/chunk-LNMI6OMN.js.map +0 -1
- package/dist/chunk-OOZCN7AF.mjs.map +0 -1
- package/dist/chunk-WRCX2NKY.mjs.map +0 -1
- package/dist/chunk-Z6EHHJWU.mjs.map +0 -1
|
@@ -263,6 +263,7 @@ async function generateCategoryStaticParams() {
|
|
|
263
263
|
async function generateBlogSitemap(siteUrl) {
|
|
264
264
|
const slugs = await getAllBlogSlugs();
|
|
265
265
|
const categories = await getBlogCategories();
|
|
266
|
+
const clusters = await getTopicClusters();
|
|
266
267
|
const entries = [
|
|
267
268
|
// Blog index
|
|
268
269
|
{
|
|
@@ -271,6 +272,13 @@ async function generateBlogSitemap(siteUrl) {
|
|
|
271
272
|
priority: 0.8
|
|
272
273
|
}
|
|
273
274
|
];
|
|
275
|
+
clusters.forEach((cluster) => {
|
|
276
|
+
entries.push({
|
|
277
|
+
url: `${siteUrl}/blog/cluster/${cluster.cluster_slug}`,
|
|
278
|
+
changeFrequency: "weekly",
|
|
279
|
+
priority: 0.8
|
|
280
|
+
});
|
|
281
|
+
});
|
|
274
282
|
categories.forEach((cat) => {
|
|
275
283
|
entries.push({
|
|
276
284
|
url: `${siteUrl}/blog/category/${cat.slug}`,
|
|
@@ -279,11 +287,12 @@ async function generateBlogSitemap(siteUrl) {
|
|
|
279
287
|
});
|
|
280
288
|
});
|
|
281
289
|
slugs.forEach((post) => {
|
|
290
|
+
const isPillar = post.article_type === "pillar";
|
|
282
291
|
entries.push({
|
|
283
292
|
url: `${siteUrl}/blog/${post.slug}`,
|
|
284
293
|
lastModified: post.last_modified ? new Date(post.last_modified) : void 0,
|
|
285
|
-
changeFrequency: "weekly",
|
|
286
|
-
priority: 0.7
|
|
294
|
+
changeFrequency: isPillar ? "weekly" : "monthly",
|
|
295
|
+
priority: isPillar ? 0.9 : 0.7
|
|
287
296
|
});
|
|
288
297
|
});
|
|
289
298
|
return entries;
|
|
@@ -536,23 +545,83 @@ async function generateAtomFeed(options) {
|
|
|
536
545
|
atom += `</feed>`;
|
|
537
546
|
return atom;
|
|
538
547
|
}
|
|
539
|
-
async function
|
|
548
|
+
async function getTopicClusters() {
|
|
540
549
|
const { apiUrl, apiKey } = getConfig();
|
|
541
550
|
if (!apiKey) return [];
|
|
542
551
|
try {
|
|
543
|
-
const response = await fetch(`${apiUrl}/public/blog/
|
|
552
|
+
const response = await fetch(`${apiUrl}/public/blog/clusters`, {
|
|
544
553
|
headers: { "x-api-key": apiKey },
|
|
545
554
|
next: { revalidate: 300 }
|
|
546
555
|
});
|
|
547
556
|
if (!response.ok) return [];
|
|
548
557
|
const data = await response.json();
|
|
549
|
-
return data.
|
|
558
|
+
return (data.clusters || []).map((c) => ({
|
|
559
|
+
id: c.id,
|
|
560
|
+
cluster_name: c.cluster_name,
|
|
561
|
+
cluster_slug: c.cluster_slug,
|
|
562
|
+
core_topic: c.core_topic,
|
|
563
|
+
primary_entity: c.primary_entity,
|
|
564
|
+
industry: c.industry,
|
|
565
|
+
geo_target: c.geo_target,
|
|
566
|
+
commercial_goal: c.commercial_goal,
|
|
567
|
+
pillar_post_id: c.pillar_post_id,
|
|
568
|
+
target_service_page: c.target_service_page,
|
|
569
|
+
article_count: c.article_count,
|
|
570
|
+
pillar: null,
|
|
571
|
+
supports: [],
|
|
572
|
+
interlink_map: []
|
|
573
|
+
}));
|
|
550
574
|
} catch (error) {
|
|
551
|
-
console.error("[Blog] Error fetching
|
|
575
|
+
console.error("[Blog] Error fetching topic clusters:", error);
|
|
552
576
|
return [];
|
|
553
577
|
}
|
|
554
578
|
}
|
|
579
|
+
async function getTopicCluster(slug) {
|
|
580
|
+
const { apiUrl, apiKey } = getConfig();
|
|
581
|
+
if (!apiKey) return null;
|
|
582
|
+
try {
|
|
583
|
+
const response = await fetch(`${apiUrl}/public/blog/clusters/${slug}`, {
|
|
584
|
+
headers: { "x-api-key": apiKey },
|
|
585
|
+
next: { revalidate: 300 }
|
|
586
|
+
});
|
|
587
|
+
if (!response.ok) return null;
|
|
588
|
+
const data = await response.json();
|
|
589
|
+
return {
|
|
590
|
+
id: data.id,
|
|
591
|
+
cluster_name: data.cluster_name,
|
|
592
|
+
cluster_slug: data.cluster_slug,
|
|
593
|
+
core_topic: data.core_topic,
|
|
594
|
+
primary_entity: data.primary_entity,
|
|
595
|
+
industry: data.industry,
|
|
596
|
+
geo_target: data.geo_target,
|
|
597
|
+
commercial_goal: data.commercial_goal,
|
|
598
|
+
pillar_post_id: data.pillar?.id,
|
|
599
|
+
target_service_page: data.target_service_page,
|
|
600
|
+
article_count: data.article_count,
|
|
601
|
+
pillar: data.pillar || null,
|
|
602
|
+
supports: data.supports || [],
|
|
603
|
+
interlink_map: data.interlink_map || []
|
|
604
|
+
};
|
|
605
|
+
} catch (error) {
|
|
606
|
+
console.error("[Blog] Error fetching topic cluster:", error);
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function getClusterNavigation(post) {
|
|
611
|
+
if (!post.cluster_id && !post.cluster_slug) return null;
|
|
612
|
+
const isPillar = post.article_type === "pillar";
|
|
613
|
+
return {
|
|
614
|
+
cluster_name: post.cluster_name || "",
|
|
615
|
+
cluster_slug: post.cluster_slug || "",
|
|
616
|
+
pillar: isPillar ? null : post.parent_pillar_slug ? { slug: post.parent_pillar_slug, title: post.parent_pillar_title || "" } : null,
|
|
617
|
+
siblings: post.sibling_articles || [],
|
|
618
|
+
is_pillar: isPillar
|
|
619
|
+
};
|
|
620
|
+
}
|
|
555
621
|
async function identifyTopicClusters(categorySlug) {
|
|
622
|
+
console.warn(
|
|
623
|
+
"[Blog] identifyTopicClusters() is deprecated. Use getTopicCluster(slug) for real cluster data managed in the Sonor dashboard."
|
|
624
|
+
);
|
|
556
625
|
const posts = await getPostsByCategory(categorySlug);
|
|
557
626
|
if (posts.length < 3) return null;
|
|
558
627
|
const sortedByLength = [...posts].sort((a, b) => (b.word_count || 0) - (a.word_count || 0));
|
|
@@ -560,23 +629,158 @@ async function identifyTopicClusters(categorySlug) {
|
|
|
560
629
|
const supportingPosts = sortedByLength.slice(1);
|
|
561
630
|
const internalLinks = [];
|
|
562
631
|
for (const support of supportingPosts) {
|
|
563
|
-
internalLinks.push({
|
|
564
|
-
|
|
565
|
-
to: support.slug,
|
|
566
|
-
anchor: support.title
|
|
567
|
-
});
|
|
632
|
+
internalLinks.push({ from: pillar.slug, to: support.slug, anchor: support.title });
|
|
633
|
+
internalLinks.push({ from: support.slug, to: pillar.slug, anchor: pillar.title });
|
|
568
634
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
635
|
+
return { pillar, supportingPosts, internalLinks };
|
|
636
|
+
}
|
|
637
|
+
async function getPostsByCategory(categorySlug) {
|
|
638
|
+
const { apiUrl, apiKey } = getConfig();
|
|
639
|
+
if (!apiKey) return [];
|
|
640
|
+
try {
|
|
641
|
+
const response = await fetch(`${apiUrl}/public/blog/posts?category=${categorySlug}&limit=50`, {
|
|
642
|
+
headers: { "x-api-key": apiKey },
|
|
643
|
+
next: { revalidate: 300 }
|
|
574
644
|
});
|
|
645
|
+
if (!response.ok) return [];
|
|
646
|
+
const data = await response.json();
|
|
647
|
+
return data.posts || [];
|
|
648
|
+
} catch (error) {
|
|
649
|
+
console.error("[Blog] Error fetching category posts:", error);
|
|
650
|
+
return [];
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
function generateClusterItemListSchema(cluster, options = {}) {
|
|
654
|
+
const { siteUrl = "", basePath = "/blog" } = options;
|
|
655
|
+
return {
|
|
656
|
+
"@context": "https://schema.org",
|
|
657
|
+
"@type": "ItemList",
|
|
658
|
+
name: cluster.cluster_name,
|
|
659
|
+
description: `Articles about ${cluster.core_topic}`,
|
|
660
|
+
numberOfItems: cluster.supports.length,
|
|
661
|
+
itemListElement: cluster.supports.map((post, i) => ({
|
|
662
|
+
"@type": "ListItem",
|
|
663
|
+
position: i + 1,
|
|
664
|
+
name: post.title,
|
|
665
|
+
url: `${siteUrl}${basePath}/${post.slug}`
|
|
666
|
+
}))
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
function generateClusterArticleSchema(post, cluster, options = {}) {
|
|
670
|
+
const { siteUrl = "", basePath = "/blog", siteName, logoUrl } = options;
|
|
671
|
+
const isPillar = post.article_type === "pillar";
|
|
672
|
+
const schema = {
|
|
673
|
+
"@context": "https://schema.org",
|
|
674
|
+
"@type": "Article",
|
|
675
|
+
headline: post.title,
|
|
676
|
+
description: post.excerpt || post.meta_description,
|
|
677
|
+
url: `${siteUrl}${basePath}/${post.slug}`,
|
|
678
|
+
datePublished: post.published_at,
|
|
679
|
+
dateModified: post.updated_at,
|
|
680
|
+
author: {
|
|
681
|
+
"@type": "Person",
|
|
682
|
+
name: typeof post.author === "string" ? post.author : post.author?.name
|
|
683
|
+
},
|
|
684
|
+
keywords: post.focus_keyphrase || post.keywords
|
|
685
|
+
};
|
|
686
|
+
if (post.featured_image) {
|
|
687
|
+
schema.image = {
|
|
688
|
+
"@type": "ImageObject",
|
|
689
|
+
url: post.featured_image,
|
|
690
|
+
width: post.featured_image_width || 1200,
|
|
691
|
+
height: post.featured_image_height || 630
|
|
692
|
+
};
|
|
575
693
|
}
|
|
694
|
+
if (siteName || logoUrl) {
|
|
695
|
+
schema.publisher = {
|
|
696
|
+
"@type": "Organization",
|
|
697
|
+
name: siteName,
|
|
698
|
+
...logoUrl && { logo: { "@type": "ImageObject", url: logoUrl } }
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
if (isPillar && cluster.supports.length > 0) {
|
|
702
|
+
schema.hasPart = cluster.supports.map((s) => ({
|
|
703
|
+
"@type": "Article",
|
|
704
|
+
headline: s.title,
|
|
705
|
+
url: `${siteUrl}${basePath}/${s.slug}`
|
|
706
|
+
}));
|
|
707
|
+
} else if (!isPillar && cluster.pillar) {
|
|
708
|
+
schema.isPartOf = {
|
|
709
|
+
"@type": "Article",
|
|
710
|
+
headline: cluster.pillar.title,
|
|
711
|
+
url: `${siteUrl}${basePath}/${cluster.pillar.slug}`
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
if (cluster.geo_target) {
|
|
715
|
+
schema.spatialCoverage = {
|
|
716
|
+
"@type": "Place",
|
|
717
|
+
name: cluster.geo_target
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
return schema;
|
|
721
|
+
}
|
|
722
|
+
function generateClusterBreadcrumbSchema(post, cluster, options = {}) {
|
|
723
|
+
const { siteUrl = "", siteName = "Home", basePath = "/blog" } = options;
|
|
724
|
+
const items = [
|
|
725
|
+
{ "@type": "ListItem", position: 1, name: siteName, item: siteUrl },
|
|
726
|
+
{ "@type": "ListItem", position: 2, name: "Blog", item: `${siteUrl}${basePath}` },
|
|
727
|
+
{
|
|
728
|
+
"@type": "ListItem",
|
|
729
|
+
position: 3,
|
|
730
|
+
name: cluster.cluster_name,
|
|
731
|
+
item: `${siteUrl}${basePath}/cluster/${cluster.cluster_slug}`
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"@type": "ListItem",
|
|
735
|
+
position: 4,
|
|
736
|
+
name: post.title,
|
|
737
|
+
item: `${siteUrl}${basePath}/${post.slug}`
|
|
738
|
+
}
|
|
739
|
+
];
|
|
740
|
+
return {
|
|
741
|
+
"@context": "https://schema.org",
|
|
742
|
+
"@type": "BreadcrumbList",
|
|
743
|
+
itemListElement: items
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
function generateClusterLandingSchema(cluster, options = {}) {
|
|
747
|
+
const { siteUrl = "", basePath = "/blog", siteName } = options;
|
|
748
|
+
return {
|
|
749
|
+
"@context": "https://schema.org",
|
|
750
|
+
"@type": "CollectionPage",
|
|
751
|
+
name: cluster.cluster_name,
|
|
752
|
+
description: `Comprehensive guide to ${cluster.core_topic}`,
|
|
753
|
+
url: `${siteUrl}${basePath}/cluster/${cluster.cluster_slug}`,
|
|
754
|
+
...siteName && {
|
|
755
|
+
isPartOf: { "@type": "WebSite", name: siteName, url: siteUrl }
|
|
756
|
+
},
|
|
757
|
+
mainEntity: cluster.pillar ? {
|
|
758
|
+
"@type": "Article",
|
|
759
|
+
headline: cluster.pillar.title,
|
|
760
|
+
url: `${siteUrl}${basePath}/${cluster.pillar.slug}`
|
|
761
|
+
} : void 0,
|
|
762
|
+
hasPart: cluster.supports.map((s) => ({
|
|
763
|
+
"@type": "Article",
|
|
764
|
+
headline: s.title,
|
|
765
|
+
url: `${siteUrl}${basePath}/${s.slug}`
|
|
766
|
+
}))
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
async function generateClusterPageMetadata(clusterSlug, options = {}) {
|
|
770
|
+
const cluster = await getTopicCluster(clusterSlug);
|
|
771
|
+
if (!cluster) return {};
|
|
772
|
+
const { siteName = "", siteUrl = "", basePath = "/blog" } = options;
|
|
773
|
+
const title = `${cluster.cluster_name}${siteName ? ` | ${siteName}` : ""}`;
|
|
774
|
+
const description = `Comprehensive guide to ${cluster.core_topic}. ${cluster.article_count} articles covering everything you need to know.`;
|
|
576
775
|
return {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
776
|
+
title,
|
|
777
|
+
description,
|
|
778
|
+
openGraph: {
|
|
779
|
+
title,
|
|
780
|
+
description,
|
|
781
|
+
url: `${siteUrl}${basePath}/cluster/${cluster.cluster_slug}`,
|
|
782
|
+
type: "website"
|
|
783
|
+
}
|
|
580
784
|
};
|
|
581
785
|
}
|
|
582
786
|
async function getRelatedInsights(currentSlug, options = {}) {
|
|
@@ -811,6 +1015,11 @@ exports.generateBlogSitemap = generateBlogSitemap;
|
|
|
811
1015
|
exports.generateBlogStaticParams = generateBlogStaticParams;
|
|
812
1016
|
exports.generateBreadcrumbSchema = generateBreadcrumbSchema;
|
|
813
1017
|
exports.generateCategoryStaticParams = generateCategoryStaticParams;
|
|
1018
|
+
exports.generateClusterArticleSchema = generateClusterArticleSchema;
|
|
1019
|
+
exports.generateClusterBreadcrumbSchema = generateClusterBreadcrumbSchema;
|
|
1020
|
+
exports.generateClusterItemListSchema = generateClusterItemListSchema;
|
|
1021
|
+
exports.generateClusterLandingSchema = generateClusterLandingSchema;
|
|
1022
|
+
exports.generateClusterPageMetadata = generateClusterPageMetadata;
|
|
814
1023
|
exports.generateFaqSchema = generateFaqSchema;
|
|
815
1024
|
exports.generateHowToSchema = generateHowToSchema;
|
|
816
1025
|
exports.generateRssFeed = generateRssFeed;
|
|
@@ -821,11 +1030,14 @@ exports.getAuthorBySlug = getAuthorBySlug;
|
|
|
821
1030
|
exports.getAuthorPosts = getAuthorPosts;
|
|
822
1031
|
exports.getBlogCategories = getBlogCategories;
|
|
823
1032
|
exports.getBlogPost = getBlogPost;
|
|
1033
|
+
exports.getClusterNavigation = getClusterNavigation;
|
|
824
1034
|
exports.getPostsByCategory = getPostsByCategory;
|
|
825
1035
|
exports.getRelatedInsights = getRelatedInsights;
|
|
1036
|
+
exports.getTopicCluster = getTopicCluster;
|
|
1037
|
+
exports.getTopicClusters = getTopicClusters;
|
|
826
1038
|
exports.identifyTopicClusters = identifyTopicClusters;
|
|
827
1039
|
exports.validateBlogPostSeo = validateBlogPostSeo;
|
|
828
1040
|
exports.validateMetaDescription = validateMetaDescription;
|
|
829
1041
|
exports.validateSeoTitle = validateSeoTitle;
|
|
830
|
-
//# sourceMappingURL=chunk-
|
|
831
|
-
//# sourceMappingURL=chunk-
|
|
1042
|
+
//# sourceMappingURL=chunk-DZKX3GHL.js.map
|
|
1043
|
+
//# sourceMappingURL=chunk-DZKX3GHL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/blog/server-core.ts"],"names":["description"],"mappings":";;;AAoBA,SAAS,SAAA,GAA8B;AACrC,EAAA,OAAO;AAAA,IACL,MAAA,EACE,OAAA,CAAQ,GAAA,CAAI,aAAA,IACZ,OAAA,CAAQ,GAAA,CAAI,yBAAA,IACZ,OAAA,CAAQ,GAAA,CAAI,0BAAA,IACZ,OAAA,CAAQ,GAAA,CAAI,2BAAA,IACZ,sBAAA;AAAA,IACF,MAAA,EACE,QAAQ,GAAA,CAAI,aAAA,IACZ,QAAQ,GAAA,CAAI,yBAAA,IACZ,OAAA,CAAQ,GAAA,CAAI,2BAAA,IACZ;AAAA,GACJ;AACF;AAMO,IAAM,UAAA,GAAa;AAAA,EACxB,OAAO,EAAE,GAAA,EAAK,IAAI,GAAA,EAAK,EAAA,EAAI,aAAa,EAAA,EAAG;AAAA,EAC3C,iBAAiB,EAAE,GAA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EAAG,MAAA,CAAO,aAAa,MAAA,CAAO,WAAA;AACpF,EAAA,IAAI,MAAA,CAAO,WAAA,IAAe,MAAA,CAAO,WAAA,CAAY,SAAS,CAAA,EAAG;AACvD,IAAA,MAAA,CAAO,aAAA,GAAgB,MAAA,CAAO,WAAA,CAAY,GAAA,CAAI,CAAC,CAAA,MAAO;AAAA,MACpD,OAAA,EAAS,mCAAA;AAAA,MACT,kBAAA,EAAoB;AAAA,KACtB,CAAE,CAAA;AAAA,EACJ;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-DZKX3GHL.js","sourcesContent":["/**\n * @sonordev/site-kit/blog/server\n *\n * Data and metadata helpers only (no React components). For `BlogPost` / `BlogList`\n * in the App Router, import from `@sonordev/site-kit/blog/server-ui` so Next never\n * treats `getAllBlogSlugs` / `generateBlogStaticParams` as client code.\n */\n\nimport type { Metadata } from 'next'\nimport type { BlogPost as BlogPostRecord, BlogAuthor, TocItem, TopicCluster, ClusterNavigation } from './types'\n\n// ============================================================================\n// CONFIGURATION\n// ============================================================================\n\ninterface BlogServerConfig {\n apiUrl: string\n apiKey: string\n}\n\nfunction getConfig(): BlogServerConfig {\n return {\n apiUrl:\n process.env.SONOR_API_URL ||\n process.env.NEXT_PUBLIC_SONOR_API_URL ||\n process.env.NEXT_PUBLIC_PORTAL_API_URL ||\n process.env.NEXT_PUBLIC_UPTRADE_API_URL ||\n 'https://api.sonor.io',\n apiKey:\n process.env.SONOR_API_KEY ||\n process.env.NEXT_PUBLIC_SONOR_API_KEY ||\n process.env.NEXT_PUBLIC_UPTRADE_API_KEY ||\n '',\n }\n}\n\n// ============================================================================\n// SEO VALIDATION UTILITIES\n// ============================================================================\n\nexport const SEO_LIMITS = {\n title: { min: 30, max: 60, recommended: 55 },\n metaDescription: { min: 120, max: 160, recommended: 155 },\n excerpt: { min: 100, max: 300, recommended: 200 },\n slug: { max: 75 },\n focusKeyphrase: { min: 2, max: 4, words: true }, // 2-4 words\n} as const\n\nexport interface SeoValidationResult {\n field: string\n value: string\n length: number\n limit: { min?: number; max: number; recommended?: number }\n status: 'good' | 'warning' | 'error'\n message: string\n}\n\n/**\n * Validate SEO title (60 chars max, keyword-first recommended)\n */\nexport function validateSeoTitle(title: string, focusKeyphrase?: string): SeoValidationResult {\n const length = title.length\n let status: SeoValidationResult['status'] = 'good'\n let message = 'Title length is optimal'\n\n if (length > SEO_LIMITS.title.max) {\n status = 'error'\n message = `Title is ${length - SEO_LIMITS.title.max} characters too long (max ${SEO_LIMITS.title.max})`\n } else if (length < SEO_LIMITS.title.min) {\n status = 'warning'\n message = `Title is short (${length}/${SEO_LIMITS.title.min} min)`\n } else if (focusKeyphrase && !title.toLowerCase().includes(focusKeyphrase.toLowerCase())) {\n status = 'warning'\n message = 'Focus keyphrase not found in title'\n } else if (focusKeyphrase && !title.toLowerCase().startsWith(focusKeyphrase.toLowerCase())) {\n status = 'warning'\n message = 'Title should start with focus keyphrase for best results'\n }\n\n return { field: 'title', value: title, length, limit: SEO_LIMITS.title, status, message }\n}\n\n/**\n * Validate meta description (150-160 chars, benefit-driven)\n */\nexport function validateMetaDescription(description: string, focusKeyphrase?: string): SeoValidationResult {\n const length = description.length\n let status: SeoValidationResult['status'] = 'good'\n let message = 'Meta description is optimal'\n\n if (length > SEO_LIMITS.metaDescription.max) {\n status = 'error'\n message = `Description will be truncated (${length}/${SEO_LIMITS.metaDescription.max})`\n } else if (length < SEO_LIMITS.metaDescription.min) {\n status = 'warning'\n message = `Description is short (${length}/${SEO_LIMITS.metaDescription.min} min)`\n } else if (focusKeyphrase && !description.toLowerCase().includes(focusKeyphrase.toLowerCase())) {\n status = 'warning'\n message = 'Focus keyphrase not found in description'\n }\n\n return { field: 'meta_description', value: description, length, limit: SEO_LIMITS.metaDescription, status, message }\n}\n\n/**\n * Full SEO validation for a blog post\n */\nexport function validateBlogPostSeo(post: Partial<BlogPostRecord>): SeoValidationResult[] {\n const results: SeoValidationResult[] = []\n const focusKeyphrase = post.focus_keyphrase\n\n if (post.meta_title || post.title) {\n results.push(validateSeoTitle(post.meta_title || post.title || '', focusKeyphrase))\n }\n\n if (post.meta_description) {\n results.push(validateMetaDescription(post.meta_description, focusKeyphrase))\n }\n\n // Check H1 alignment (title should match keyword)\n if (post.title && focusKeyphrase) {\n const titleLower = post.title.toLowerCase()\n const keyLower = focusKeyphrase.toLowerCase()\n if (!titleLower.includes(keyLower)) {\n results.push({\n field: 'h1_alignment',\n value: post.title,\n length: post.title.length,\n limit: { max: 100 },\n status: 'warning',\n message: 'H1 (title) should include the focus keyphrase',\n })\n }\n }\n\n // Check word count (1200-2500 recommended for long-form)\n if (post.word_count !== undefined) {\n let wordStatus: SeoValidationResult['status'] = 'good'\n let wordMessage = 'Content length is optimal for SEO'\n \n if (post.word_count < 600) {\n wordStatus = 'error'\n wordMessage = `Content is thin (${post.word_count} words). Aim for 1200+ words.`\n } else if (post.word_count < 1200) {\n wordStatus = 'warning'\n wordMessage = `Content is short (${post.word_count} words). Long-form (1200-2500) ranks better.`\n } else if (post.word_count > 2500) {\n wordMessage = `Comprehensive content (${post.word_count} words). Consider splitting into a topic cluster.`\n }\n\n results.push({\n field: 'word_count',\n value: String(post.word_count),\n length: post.word_count,\n limit: { min: 1200, max: 2500, recommended: 1800 },\n status: wordStatus,\n message: wordMessage,\n })\n }\n\n return results\n}\n\n// ============================================================================\n// DATA FETCHING\n// ============================================================================\n\n/**\n * Fetch a blog post by slug (server-side)\n */\nexport async function getBlogPost(slug: string): Promise<BlogPostRecord | null> {\n const { apiUrl, apiKey } = getConfig()\n\n if (!apiKey) {\n console.warn('[Blog] No API key configured')\n return null\n }\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/posts/${slug}`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 60 },\n })\n\n if (!response.ok) return null\n\n const data = await response.json()\n return data.post || null\n } catch (error) {\n console.error('[Blog] Error fetching post:', error)\n return null\n }\n}\n\n/**\n * Fetch all blog post slugs for static generation\n */\nexport async function getAllBlogSlugs(): Promise<\n { slug: string; id?: string; last_modified?: string; article_type?: string }[]\n> {\n const { apiUrl, apiKey } = getConfig()\n\n if (!apiKey) {\n console.warn('[Blog] No API key configured')\n return []\n }\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/slugs`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 300 },\n })\n\n if (!response.ok) return []\n\n const data = await response.json()\n return data.slugs || []\n } catch (error) {\n console.error('[Blog] Error fetching slugs:', error)\n return []\n }\n}\n\n/**\n * Fetch blog categories\n */\nexport async function getBlogCategories(): Promise<{ name: string; slug: string; post_count: number }[]> {\n const { apiUrl, apiKey } = getConfig()\n\n if (!apiKey) return []\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/categories`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 300 },\n })\n\n if (!response.ok) return []\n\n const data = await response.json()\n return data.categories || []\n } catch (error) {\n console.error('[Blog] Error fetching categories:', error)\n return []\n }\n}\n\n// ============================================================================\n// METADATA GENERATION\n// ============================================================================\n\ninterface BlogMetadataOptions {\n /** Site name for og:site_name */\n siteName?: string\n /** Base URL of the site */\n siteUrl?: string\n /** URL path prefix for blog index and posts (default `/blog`, e.g. `/insights`) */\n blogBasePath?: string\n /** Default OG image */\n defaultImage?: string\n /** Twitter handle */\n twitterHandle?: string\n}\n\nfunction blogPathPrefix(options: BlogMetadataOptions): string {\n const raw = (options.blogBasePath ?? '/blog').trim() || '/blog'\n const withSlash = raw.startsWith('/') ? raw : `/${raw}`\n return withSlash.replace(/\\/$/, '') || '/blog'\n}\n\n/**\n * Generate metadata for a blog post page\n */\nexport async function generateBlogPostMetadata(\n slug: string,\n options: BlogMetadataOptions = {}\n): Promise<Metadata> {\n const post = await getBlogPost(slug)\n const { siteName, siteUrl = '', defaultImage, twitterHandle } = options\n const base = blogPathPrefix(options)\n\n if (!post) {\n return {\n title: 'Post Not Found',\n description: 'The requested blog post could not be found.',\n }\n }\n\n const title = post.meta_title || post.title\n const description = post.meta_description || post.excerpt || ''\n const image = post.og_image || post.featured_image || defaultImage\n const url = `${siteUrl}${base}/${post.slug}`\n\n return {\n title,\n description,\n openGraph: {\n title: post.og_title || title,\n description: post.og_description || description,\n url,\n siteName,\n type: 'article',\n publishedTime: post.published_at,\n authors: post.author ? [typeof post.author === 'string' ? post.author : post.author.name] : undefined,\n images: image\n ? [\n {\n url: image,\n width: post.featured_image_width || 1200,\n height: post.featured_image_height || 630,\n alt: post.featured_image_alt || post.title,\n },\n ]\n : undefined,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: image ? [image] : undefined,\n creator: twitterHandle,\n },\n alternates: {\n canonical: post.canonical_url || url,\n },\n other: {\n 'article:published_time': post.published_at || '',\n 'article:section': typeof post.category === 'string' ? post.category : (post.category?.name || ''),\n },\n }\n}\n\n/**\n * Generate metadata for the blog index page\n */\nexport function generateBlogIndexMetadata(options: BlogMetadataOptions & {\n title?: string\n description?: string\n}): Metadata {\n const {\n title = 'Blog',\n description = 'Read our latest articles and insights.',\n siteName,\n siteUrl = '',\n defaultImage,\n twitterHandle,\n } = options\n const base = blogPathPrefix(options)\n\n return {\n title,\n description,\n openGraph: {\n title,\n description,\n url: `${siteUrl}${base}`,\n siteName,\n type: 'website',\n images: defaultImage ? [{ url: defaultImage }] : undefined,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: defaultImage ? [defaultImage] : undefined,\n creator: twitterHandle,\n },\n }\n}\n\n/**\n * Generate metadata for a category page\n */\nexport function generateBlogCategoryMetadata(\n categoryName: string,\n options: BlogMetadataOptions = {}\n): Metadata {\n const { siteName, siteUrl = '', defaultImage } = options\n const title = `${categoryName} - Blog`\n const description = `Browse all posts in ${categoryName}.`\n\n return {\n title,\n description,\n openGraph: {\n title,\n description,\n url: `${siteUrl}/blog/category/${categoryName.toLowerCase()}`,\n siteName,\n type: 'website',\n images: defaultImage ? [{ url: defaultImage }] : undefined,\n },\n }\n}\n\n// ============================================================================\n// STATIC PARAMS GENERATION\n// ============================================================================\n\n/**\n * Generate static params for blog post pages\n * Usage: export const generateStaticParams = generateBlogStaticParams\n */\nexport async function generateBlogStaticParams(): Promise<{ slug: string }[]> {\n const slugs = await getAllBlogSlugs()\n return slugs.map((s) => ({ slug: s.slug }))\n}\n\n/**\n * Generate static params for category pages\n * Usage: export const generateStaticParams = generateCategoryStaticParams\n */\nexport async function generateCategoryStaticParams(): Promise<{ category: string }[]> {\n const categories = await getBlogCategories()\n return categories.map((c) => ({ category: c.slug }))\n}\n\n// ============================================================================\n// SITEMAP GENERATION\n// ============================================================================\n\ninterface SitemapEntry {\n url: string\n lastModified?: Date\n changeFrequency?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'\n priority?: number\n}\n\n/**\n * Generate sitemap entries for blog posts\n */\nexport async function generateBlogSitemap(\n siteUrl: string\n): Promise<SitemapEntry[]> {\n const slugs = await getAllBlogSlugs()\n const categories = await getBlogCategories()\n const clusters = await getTopicClusters()\n\n const entries: SitemapEntry[] = [\n // Blog index\n {\n url: `${siteUrl}/blog`,\n changeFrequency: 'daily',\n priority: 0.8,\n },\n ]\n\n // Cluster landing pages\n clusters.forEach((cluster) => {\n entries.push({\n url: `${siteUrl}/blog/cluster/${cluster.cluster_slug}`,\n changeFrequency: 'weekly',\n priority: 0.8,\n })\n })\n\n // Category pages\n categories.forEach((cat) => {\n entries.push({\n url: `${siteUrl}/blog/category/${cat.slug}`,\n changeFrequency: 'weekly',\n priority: 0.6,\n })\n })\n\n // Individual posts — pillar posts get higher priority (0.9 vs 0.7)\n slugs.forEach((post) => {\n const isPillar = (post as any).article_type === 'pillar'\n entries.push({\n url: `${siteUrl}/blog/${post.slug}`,\n lastModified: post.last_modified ? new Date(post.last_modified) : undefined,\n changeFrequency: isPillar ? 'weekly' : 'monthly',\n priority: isPillar ? 0.9 : 0.7,\n })\n })\n\n return entries\n}\n\n// ============================================================================\n// JSON-LD SCHEMA GENERATION\n// ============================================================================\n\n/**\n * Generate JSON-LD schema for a blog post\n */\nexport function generateBlogPostSchema(\n post: BlogPostRecord,\n options: { siteUrl?: string; siteName?: string; logoUrl?: string } = {}\n): object {\n const { siteUrl = '', siteName, logoUrl } = options\n\n const schema: any = {\n '@context': 'https://schema.org',\n '@type': 'BlogPosting',\n headline: post.title,\n description: post.excerpt || post.meta_description,\n url: `${siteUrl}/blog/${post.slug}`,\n datePublished: post.published_at,\n dateModified: post.updated_at,\n author: {\n '@type': 'Person',\n name: typeof post.author === 'string' ? post.author : post.author?.name,\n },\n }\n\n if (post.featured_image) {\n schema.image = {\n '@type': 'ImageObject',\n url: post.featured_image,\n width: post.featured_image_width || 1200,\n height: post.featured_image_height || 630,\n }\n }\n\n if (siteName || logoUrl) {\n schema.publisher = {\n '@type': 'Organization',\n name: siteName,\n logo: logoUrl\n ? {\n '@type': 'ImageObject',\n url: logoUrl,\n }\n : undefined,\n }\n }\n\n // Add FAQ schema if present\n if (post.faq_items && Array.isArray(post.faq_items) && post.faq_items.length > 0) {\n schema.mainEntity = {\n '@type': 'FAQPage',\n mainEntity: post.faq_items.map((faq: { question: string; answer: string }) => ({\n '@type': 'Question',\n name: faq.question,\n acceptedAnswer: {\n '@type': 'Answer',\n text: faq.answer,\n },\n })),\n }\n }\n\n return schema\n}\n\n/**\n * Generate JSON-LD schema for blog index/listing page\n */\nexport function generateBlogListSchema(\n options: { siteUrl?: string; siteName?: string; description?: string } = {}\n): object {\n const { siteUrl = '', siteName, description } = options\n\n return {\n '@context': 'https://schema.org',\n '@type': 'Blog',\n name: siteName ? `${siteName} Blog` : 'Blog',\n description: description || 'Our latest articles and insights.',\n url: `${siteUrl}/blog`,\n }\n}\n\n// ============================================================================\n// FAQ SCHEMA (for PAA rankings)\n// ============================================================================\n\n/**\n * Generate standalone FAQ schema (great for PAA inclusion)\n */\nexport function generateFaqSchema(\n faqItems: { question: string; answer: string }[]\n): object | null {\n if (!faqItems || faqItems.length === 0) return null\n\n return {\n '@context': 'https://schema.org',\n '@type': 'FAQPage',\n mainEntity: faqItems.map((faq) => ({\n '@type': 'Question',\n name: faq.question,\n acceptedAnswer: {\n '@type': 'Answer',\n text: faq.answer,\n },\n })),\n }\n}\n\n// ============================================================================\n// HOWTO SCHEMA (for step-by-step posts)\n// ============================================================================\n\nexport interface HowToStep {\n name: string\n text: string\n image?: string\n url?: string\n}\n\n/**\n * Generate HowTo schema for step-by-step posts\n */\nexport function generateHowToSchema(\n post: BlogPostRecord,\n steps: HowToStep[],\n options: { siteUrl?: string } = {}\n): object {\n const { siteUrl = '' } = options\n\n return {\n '@context': 'https://schema.org',\n '@type': 'HowTo',\n name: post.title,\n description: post.excerpt || post.meta_description,\n image: post.featured_image,\n totalTime: post.reading_time ? `PT${post.reading_time}M` : undefined,\n step: steps.map((step, index) => ({\n '@type': 'HowToStep',\n position: index + 1,\n name: step.name,\n text: step.text,\n image: step.image,\n url: step.url || `${siteUrl}/blog/${post.slug}#step-${index + 1}`,\n })),\n }\n}\n\n// ============================================================================\n// RSS FEED GENERATION\n// ============================================================================\n\ninterface RssFeedOptions {\n siteUrl: string\n siteName: string\n description?: string\n language?: string\n copyright?: string\n managingEditor?: string\n webMaster?: string\n ttl?: number // Time to live in minutes\n imageUrl?: string\n}\n\n/**\n * Fetch all published blog posts for RSS feed\n */\nexport async function getAllBlogPosts(): Promise<BlogPostRecord[]> {\n const { apiUrl, apiKey } = getConfig()\n\n if (!apiKey) {\n console.warn('[Blog] No API key configured')\n return []\n }\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/posts?limit=100`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 300 },\n })\n\n if (!response.ok) return []\n\n const data = await response.json()\n return data.posts || []\n } catch (error) {\n console.error('[Blog] Error fetching posts for RSS:', error)\n return []\n }\n}\n\n/**\n * Escape XML special characters\n */\nfunction escapeXml(text: string): string {\n return text\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n}\n\n/**\n * Strip HTML tags for RSS descriptions\n */\nfunction stripHtml(html: string): string {\n return html.replace(/<[^>]*>/g, '').trim()\n}\n\n/**\n * Generate RSS 2.0 feed XML\n */\nexport async function generateRssFeed(options: RssFeedOptions): Promise<string> {\n const {\n siteUrl,\n siteName,\n description = 'Latest blog posts and insights',\n language = 'en-us',\n copyright,\n managingEditor,\n webMaster,\n ttl = 60,\n imageUrl,\n } = options\n\n const posts = await getAllBlogPosts()\n const now = new Date().toUTCString()\n\n let rss = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n <channel>\n <title>${escapeXml(siteName)}</title>\n <link>${siteUrl}</link>\n <description>${escapeXml(description)}</description>\n <language>${language}</language>\n <lastBuildDate>${now}</lastBuildDate>\n <pubDate>${now}</pubDate>\n <ttl>${ttl}</ttl>\n <atom:link href=\"${siteUrl}/blog/rss.xml\" rel=\"self\" type=\"application/rss+xml\"/>\n`\n\n if (copyright) {\n rss += ` <copyright>${escapeXml(copyright)}</copyright>\\n`\n }\n\n if (managingEditor) {\n rss += ` <managingEditor>${escapeXml(managingEditor)}</managingEditor>\\n`\n }\n\n if (webMaster) {\n rss += ` <webMaster>${escapeXml(webMaster)}</webMaster>\\n`\n }\n\n if (imageUrl) {\n rss += ` <image>\n <url>${imageUrl}</url>\n <title>${escapeXml(siteName)}</title>\n <link>${siteUrl}</link>\n </image>\\n`\n }\n\n // Add each post as an item with FULL content (not excerpts)\n for (const post of posts) {\n const postUrl = `${siteUrl}/blog/${post.slug}`\n const pubDate = post.published_at ? new Date(post.published_at).toUTCString() : now\n const author = typeof post.author === 'string' ? post.author : post.author?.name || 'Unknown'\n \n // Use full content_html if available, otherwise content\n const fullContent = post.content_html || post.content || ''\n const description = post.excerpt || stripHtml(fullContent).substring(0, 300) + '...'\n\n rss += ` <item>\n <title>${escapeXml(post.title)}</title>\n <link>${postUrl}</link>\n <guid isPermaLink=\"true\">${postUrl}</guid>\n <description>${escapeXml(description)}</description>\n <content:encoded><![CDATA[${fullContent}]]></content:encoded>\n <pubDate>${pubDate}</pubDate>\n <author>${escapeXml(author)}</author>\n`\n\n if (post.category) {\n const categoryName = typeof post.category === 'string' ? post.category : post.category.name\n rss += ` <category>${escapeXml(categoryName)}</category>\\n`\n }\n\n if (post.tags && Array.isArray(post.tags)) {\n for (const tag of post.tags) {\n const tagName = typeof tag === 'string' ? tag : tag.name\n rss += ` <category>${escapeXml(tagName)}</category>\\n`\n }\n }\n\n if (post.featured_image) {\n rss += ` <enclosure url=\"${post.featured_image}\" type=\"image/jpeg\"/>\\n`\n }\n\n rss += ` </item>\\n`\n }\n\n rss += ` </channel>\n</rss>`\n\n return rss\n}\n\n/**\n * Generate Atom feed XML\n */\nexport async function generateAtomFeed(options: RssFeedOptions): Promise<string> {\n const {\n siteUrl,\n siteName,\n description = 'Latest blog posts and insights',\n managingEditor,\n } = options\n\n const posts = await getAllBlogPosts()\n const now = new Date().toISOString()\n\n let atom = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<feed xmlns=\"http://www.w3.org/2005/Atom\">\n <title>${escapeXml(siteName)}</title>\n <subtitle>${escapeXml(description)}</subtitle>\n <link href=\"${siteUrl}/blog/feed.xml\" rel=\"self\"/>\n <link href=\"${siteUrl}\"/>\n <id>${siteUrl}/blog</id>\n <updated>${now}</updated>\n`\n\n if (managingEditor) {\n atom += ` <author>\n <name>${escapeXml(managingEditor)}</name>\n </author>\\n`\n }\n\n for (const post of posts) {\n const postUrl = `${siteUrl}/blog/${post.slug}`\n const updated = post.updated_at || post.published_at || now\n const published = post.published_at || now\n const author = typeof post.author === 'string' ? post.author : post.author?.name || 'Unknown'\n const fullContent = post.content_html || post.content || ''\n\n atom += ` <entry>\n <title>${escapeXml(post.title)}</title>\n <link href=\"${postUrl}\"/>\n <id>${postUrl}</id>\n <updated>${new Date(updated).toISOString()}</updated>\n <published>${new Date(published).toISOString()}</published>\n <author>\n <name>${escapeXml(author)}</name>\n </author>\n <summary>${escapeXml(post.excerpt || stripHtml(fullContent).substring(0, 300))}</summary>\n <content type=\"html\"><![CDATA[${fullContent}]]></content>\n </entry>\\n`\n }\n\n atom += `</feed>`\n\n return atom\n}\n\n// ============================================================================\n// TOPIC CLUSTER SUPPORT\n// ============================================================================\n\n/**\n * Fetch all active topic clusters for the project.\n * Uses the real cluster data from Portal API (not heuristic-based).\n */\nexport async function getTopicClusters(): Promise<TopicCluster[]> {\n const { apiUrl, apiKey } = getConfig()\n if (!apiKey) return []\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/clusters`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 300 },\n })\n if (!response.ok) return []\n const data = await response.json()\n\n return (data.clusters || []).map((c: any) => ({\n id: c.id,\n cluster_name: c.cluster_name,\n cluster_slug: c.cluster_slug,\n core_topic: c.core_topic,\n primary_entity: c.primary_entity,\n industry: c.industry,\n geo_target: c.geo_target,\n commercial_goal: c.commercial_goal,\n pillar_post_id: c.pillar_post_id,\n target_service_page: c.target_service_page,\n article_count: c.article_count,\n pillar: null,\n supports: [],\n interlink_map: [],\n }))\n } catch (error) {\n console.error('[Blog] Error fetching topic clusters:', error)\n return []\n }\n}\n\n/**\n * Fetch a single topic cluster with its pillar and support articles.\n */\nexport async function getTopicCluster(slug: string): Promise<TopicCluster | null> {\n const { apiUrl, apiKey } = getConfig()\n if (!apiKey) return null\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/clusters/${slug}`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 300 },\n })\n if (!response.ok) return null\n const data = await response.json()\n\n return {\n id: data.id,\n cluster_name: data.cluster_name,\n cluster_slug: data.cluster_slug,\n core_topic: data.core_topic,\n primary_entity: data.primary_entity,\n industry: data.industry,\n geo_target: data.geo_target,\n commercial_goal: data.commercial_goal,\n pillar_post_id: data.pillar?.id,\n target_service_page: data.target_service_page,\n article_count: data.article_count,\n pillar: data.pillar || null,\n supports: data.supports || [],\n interlink_map: data.interlink_map || [],\n }\n } catch (error) {\n console.error('[Blog] Error fetching topic cluster:', error)\n return null\n }\n}\n\n/**\n * Get cluster navigation context for a blog post.\n * Returns the cluster name, pillar link, and sibling articles.\n */\nexport function getClusterNavigation(post: BlogPostRecord): ClusterNavigation | null {\n if (!post.cluster_id && !post.cluster_slug) return null\n\n const isPillar = post.article_type === 'pillar'\n\n return {\n cluster_name: post.cluster_name || '',\n cluster_slug: post.cluster_slug || '',\n pillar: isPillar\n ? null\n : post.parent_pillar_slug\n ? { slug: post.parent_pillar_slug, title: post.parent_pillar_title || '' }\n : null,\n siblings: post.sibling_articles || [],\n is_pillar: isPillar,\n }\n}\n\n/**\n * @deprecated Use getTopicCluster(slug) instead. This naive heuristic picks\n * the longest post as pillar. Real cluster data is now managed in the Sonor dashboard.\n */\nexport async function identifyTopicClusters(categorySlug: string): Promise<{\n pillar: BlogPostRecord\n supportingPosts: BlogPostRecord[]\n internalLinks: Array<{ from: string; to: string; anchor: string }>\n} | null> {\n console.warn(\n '[Blog] identifyTopicClusters() is deprecated. Use getTopicCluster(slug) for real cluster data managed in the Sonor dashboard.'\n )\n const posts = await getPostsByCategory(categorySlug)\n if (posts.length < 3) return null\n\n const sortedByLength = [...posts].sort((a, b) => (b.word_count || 0) - (a.word_count || 0))\n const pillar = sortedByLength[0]\n const supportingPosts = sortedByLength.slice(1)\n\n const internalLinks: Array<{ from: string; to: string; anchor: string }> = []\n for (const support of supportingPosts) {\n internalLinks.push({ from: pillar.slug, to: support.slug, anchor: support.title })\n internalLinks.push({ from: support.slug, to: pillar.slug, anchor: pillar.title })\n }\n\n return { pillar, supportingPosts, internalLinks }\n}\n\n/**\n * Fetch posts by category for topic cluster organization\n */\nexport async function getPostsByCategory(categorySlug: string): Promise<BlogPostRecord[]> {\n const { apiUrl, apiKey } = getConfig()\n if (!apiKey) return []\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/posts?category=${categorySlug}&limit=50`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 300 },\n })\n if (!response.ok) return []\n const data = await response.json()\n return data.posts || []\n } catch (error) {\n console.error('[Blog] Error fetching category posts:', error)\n return []\n }\n}\n\n// ============================================================================\n// CLUSTER SCHEMA GENERATION\n// ============================================================================\n\n/**\n * Generate ItemList schema for a cluster's pillar page.\n * Wraps supporting posts as a structured list Google can parse.\n */\nexport function generateClusterItemListSchema(\n cluster: TopicCluster,\n options: { siteUrl?: string; basePath?: string } = {}\n): object {\n const { siteUrl = '', basePath = '/blog' } = options\n\n return {\n '@context': 'https://schema.org',\n '@type': 'ItemList',\n name: cluster.cluster_name,\n description: `Articles about ${cluster.core_topic}`,\n numberOfItems: cluster.supports.length,\n itemListElement: cluster.supports.map((post, i) => ({\n '@type': 'ListItem',\n position: i + 1,\n name: post.title,\n url: `${siteUrl}${basePath}/${post.slug}`,\n })),\n }\n}\n\n/**\n * Generate Article schema with cluster relationship (isPartOf / hasPart).\n * - Support articles get `isPartOf` pointing to the pillar.\n * - Pillar articles get `hasPart` listing all supports.\n */\nexport function generateClusterArticleSchema(\n post: BlogPostRecord,\n cluster: TopicCluster,\n options: { siteUrl?: string; basePath?: string; siteName?: string; logoUrl?: string } = {}\n): object {\n const { siteUrl = '', basePath = '/blog', siteName, logoUrl } = options\n const isPillar = post.article_type === 'pillar'\n\n const schema: any = {\n '@context': 'https://schema.org',\n '@type': 'Article',\n headline: post.title,\n description: post.excerpt || post.meta_description,\n url: `${siteUrl}${basePath}/${post.slug}`,\n datePublished: post.published_at,\n dateModified: post.updated_at,\n author: {\n '@type': 'Person',\n name: typeof post.author === 'string' ? post.author : (post.author as any)?.name,\n },\n keywords: post.focus_keyphrase || post.keywords,\n }\n\n if (post.featured_image) {\n schema.image = {\n '@type': 'ImageObject',\n url: post.featured_image,\n width: post.featured_image_width || 1200,\n height: post.featured_image_height || 630,\n }\n }\n\n if (siteName || logoUrl) {\n schema.publisher = {\n '@type': 'Organization',\n name: siteName,\n ...(logoUrl && { logo: { '@type': 'ImageObject', url: logoUrl } }),\n }\n }\n\n // Cluster relationships\n if (isPillar && cluster.supports.length > 0) {\n schema.hasPart = cluster.supports.map((s) => ({\n '@type': 'Article',\n headline: s.title,\n url: `${siteUrl}${basePath}/${s.slug}`,\n }))\n } else if (!isPillar && cluster.pillar) {\n schema.isPartOf = {\n '@type': 'Article',\n headline: cluster.pillar.title,\n url: `${siteUrl}${basePath}/${cluster.pillar.slug}`,\n }\n }\n\n // Geo targeting\n if (cluster.geo_target) {\n schema.spatialCoverage = {\n '@type': 'Place',\n name: cluster.geo_target,\n }\n }\n\n return schema\n}\n\n/**\n * Generate BreadcrumbList schema for a cluster-linked post.\n * Path: Home > Blog > Cluster > Article\n */\nexport function generateClusterBreadcrumbSchema(\n post: BlogPostRecord,\n cluster: TopicCluster,\n options: { siteUrl?: string; siteName?: string; basePath?: string } = {}\n): object {\n const { siteUrl = '', siteName = 'Home', basePath = '/blog' } = options\n\n const items: any[] = [\n { '@type': 'ListItem', position: 1, name: siteName, item: siteUrl },\n { '@type': 'ListItem', position: 2, name: 'Blog', item: `${siteUrl}${basePath}` },\n {\n '@type': 'ListItem',\n position: 3,\n name: cluster.cluster_name,\n item: `${siteUrl}${basePath}/cluster/${cluster.cluster_slug}`,\n },\n {\n '@type': 'ListItem',\n position: 4,\n name: post.title,\n item: `${siteUrl}${basePath}/${post.slug}`,\n },\n ]\n\n return {\n '@context': 'https://schema.org',\n '@type': 'BreadcrumbList',\n itemListElement: items,\n }\n}\n\n/**\n * Generate CollectionPage schema for a cluster landing page.\n */\nexport function generateClusterLandingSchema(\n cluster: TopicCluster,\n options: { siteUrl?: string; basePath?: string; siteName?: string } = {}\n): object {\n const { siteUrl = '', basePath = '/blog', siteName } = options\n\n return {\n '@context': 'https://schema.org',\n '@type': 'CollectionPage',\n name: cluster.cluster_name,\n description: `Comprehensive guide to ${cluster.core_topic}`,\n url: `${siteUrl}${basePath}/cluster/${cluster.cluster_slug}`,\n ...(siteName && {\n isPartOf: { '@type': 'WebSite', name: siteName, url: siteUrl },\n }),\n mainEntity: cluster.pillar\n ? {\n '@type': 'Article',\n headline: cluster.pillar.title,\n url: `${siteUrl}${basePath}/${cluster.pillar.slug}`,\n }\n : undefined,\n hasPart: cluster.supports.map((s) => ({\n '@type': 'Article',\n headline: s.title,\n url: `${siteUrl}${basePath}/${s.slug}`,\n })),\n }\n}\n\n/**\n * Generate metadata for a cluster landing page (Next.js generateMetadata).\n */\nexport async function generateClusterPageMetadata(\n clusterSlug: string,\n options: { siteName?: string; siteUrl?: string; basePath?: string } = {}\n) {\n const cluster = await getTopicCluster(clusterSlug)\n if (!cluster) return {}\n\n const { siteName = '', siteUrl = '', basePath = '/blog' } = options\n const title = `${cluster.cluster_name}${siteName ? ` | ${siteName}` : ''}`\n const description = `Comprehensive guide to ${cluster.core_topic}. ${cluster.article_count} articles covering everything you need to know.`\n\n return {\n title,\n description,\n openGraph: {\n title,\n description,\n url: `${siteUrl}${basePath}/cluster/${cluster.cluster_slug}`,\n type: 'website',\n },\n }\n}\n\n/**\n * Generate \"Related Insights\" section data\n */\nexport async function getRelatedInsights(\n currentSlug: string,\n options: { limit?: number; category?: string } = {}\n): Promise<BlogPostRecord[]> {\n const { apiUrl, apiKey } = getConfig()\n const { limit = 3, category } = options\n\n if (!apiKey) return []\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/related`, {\n method: 'POST',\n headers: {\n 'x-api-key': apiKey,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n slug: currentSlug,\n limit,\n category,\n }),\n next: { revalidate: 300 },\n })\n\n if (!response.ok) return []\n\n const data = await response.json()\n return data.posts || []\n } catch (error) {\n console.error('[Blog] Error fetching related posts:', error)\n return []\n }\n}\n\n// ============================================================================\n// BREADCRUMB SCHEMA\n// ============================================================================\n\n/**\n * Generate BreadcrumbList schema for blog navigation\n */\nexport function generateBreadcrumbSchema(\n post: BlogPostRecord,\n options: { siteUrl?: string; siteName?: string } = {}\n): object {\n const { siteUrl = '', siteName = 'Home' } = options\n\n const items = [\n {\n '@type': 'ListItem',\n position: 1,\n name: siteName,\n item: siteUrl,\n },\n {\n '@type': 'ListItem',\n position: 2,\n name: 'Blog',\n item: `${siteUrl}/blog`,\n },\n ]\n\n if (post.category) {\n const categoryName = typeof post.category === 'string' ? post.category : post.category.name\n const categorySlug = typeof post.category === 'string' \n ? post.category.toLowerCase().replace(/\\s+/g, '-')\n : post.category.slug\n\n items.push({\n '@type': 'ListItem',\n position: 3,\n name: categoryName,\n item: `${siteUrl}/blog/category/${categorySlug}`,\n })\n\n items.push({\n '@type': 'ListItem',\n position: 4,\n name: post.title,\n item: `${siteUrl}/blog/${post.slug}`,\n })\n } else {\n items.push({\n '@type': 'ListItem',\n position: 3,\n name: post.title,\n item: `${siteUrl}/blog/${post.slug}`,\n })\n }\n\n return {\n '@context': 'https://schema.org',\n '@type': 'BreadcrumbList',\n itemListElement: items,\n }\n}\n\n// ============================================================================\n// COMBINED SCHEMA (Article + FAQ + Breadcrumb)\n// ============================================================================\n\n/**\n * Generate all relevant schemas for a blog post in a single array\n * This is the recommended way to include multiple schemas.\n * When post has E-E-A-T schema (post.schema), use it instead of generating Article/FAQ.\n */\nexport function generateAllBlogSchemas(\n post: BlogPostRecord,\n options: { siteUrl?: string; siteName?: string; logoUrl?: string } = {}\n): object[] {\n const schemas: object[] = []\n\n // E-E-A-T: use pre-built schema from Signal when present\n const eeatSchema = post.schema\n if (eeatSchema) {\n const arr = Array.isArray(eeatSchema) ? eeatSchema : [eeatSchema]\n schemas.push(...arr)\n } else {\n // 1. Article/BlogPosting schema (always)\n schemas.push(generateBlogPostSchema(post, options))\n\n // 3. FAQ schema (if FAQs present)\n const faqItems = post.faq_items ?? (post as any).faqItems\n if (faqItems && faqItems.length > 0) {\n const faqSchema = generateFaqSchema(faqItems)\n if (faqSchema) schemas.push(faqSchema)\n }\n }\n\n // 2. Breadcrumb schema (always)\n schemas.push(generateBreadcrumbSchema(post, options))\n\n return schemas\n}\n\n// ============================================================================\n// AUTHOR PAGE DATA FETCHING\n// ============================================================================\n\n/**\n * Fetch a single author by slug\n */\nexport async function getAuthorBySlug(slug: string): Promise<BlogAuthor | null> {\n const { apiUrl, apiKey } = getConfig()\n\n if (!apiKey) {\n console.warn('[Blog] No API key configured')\n return null\n }\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/authors/${slug}`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 60 },\n })\n\n if (!response.ok) return null\n\n const data = await response.json()\n return data.author || null\n } catch (error) {\n console.error('[Blog] Error fetching author:', error)\n return null\n }\n}\n\n/**\n * Fetch an author's posts by slug\n */\nexport async function getAuthorPosts(\n slug: string,\n limit = 20\n): Promise<{ author: BlogAuthor | null; posts: BlogPostRecord[]; total: number }> {\n const { apiUrl, apiKey } = getConfig()\n\n if (!apiKey) {\n console.warn('[Blog] No API key configured')\n return { author: null, posts: [], total: 0 }\n }\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/authors/${slug}/posts?limit=${limit}`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 60 },\n })\n\n if (!response.ok) return { author: null, posts: [], total: 0 }\n\n const data = await response.json()\n return {\n author: data.author || null,\n posts: data.posts || [],\n total: data.total || 0,\n }\n } catch (error) {\n console.error('[Blog] Error fetching author posts:', error)\n return { author: null, posts: [], total: 0 }\n }\n}\n\n/**\n * Fetch all author slugs for static generation\n */\nexport async function getAllAuthorSlugs(): Promise<{ slug: string }[]> {\n const { apiUrl, apiKey } = getConfig()\n\n if (!apiKey) {\n console.warn('[Blog] No API key configured')\n return []\n }\n\n try {\n const response = await fetch(`${apiUrl}/public/blog/authors`, {\n headers: { 'x-api-key': apiKey },\n next: { revalidate: 300 },\n })\n\n if (!response.ok) return []\n\n const data = await response.json()\n const authors: BlogAuthor[] = data.authors || []\n return authors.map((a) => ({ slug: a.slug }))\n } catch (error) {\n console.error('[Blog] Error fetching author slugs:', error)\n return []\n }\n}\n\n/**\n * Generate static params for author pages\n * Usage: export const generateStaticParams = generateAuthorStaticParams\n */\nexport async function generateAuthorStaticParams(): Promise<{ slug: string }[]> {\n return getAllAuthorSlugs()\n}\n\n// ============================================================================\n// AUTHOR METADATA & SCHEMA\n// ============================================================================\n\n/**\n * Generate Next.js Metadata for an author page\n */\nexport function generateAuthorPageMetadata(\n author: BlogAuthor,\n options: { siteUrl?: string; siteName?: string } = {}\n): Metadata {\n const { siteUrl = '', siteName } = options\n const title = `${author.name}${author.title ? ` - ${author.title}` : ''}`\n const description = author.short_bio || author.bio || `Articles by ${author.name}`\n const url = `${siteUrl}/blog/author/${author.slug}`\n\n return {\n title,\n description,\n openGraph: {\n title,\n description,\n url,\n siteName,\n type: 'profile',\n images: author.avatar_url ? [{ url: author.avatar_url }] : undefined,\n },\n twitter: {\n card: 'summary',\n title,\n description,\n images: author.avatar_url ? [author.avatar_url] : undefined,\n },\n alternates: {\n canonical: author.author_page_url || url,\n },\n }\n}\n\n/**\n * Generate Person JSON-LD schema for an author page\n */\nexport function generateAuthorSchema(\n author: BlogAuthor,\n options: { siteUrl?: string; siteName?: string } = {}\n): object {\n const { siteUrl = '', siteName } = options\n\n const sameAs: string[] = [...(author.same_as || [])]\n if (author.linkedin_url) sameAs.push(author.linkedin_url)\n if (author.twitter_url) sameAs.push(author.twitter_url)\n if (author.website_url) sameAs.push(author.website_url)\n if (author.social_links?.twitter) sameAs.push(`https://twitter.com/${author.social_links.twitter}`)\n if (author.social_links?.linkedin) sameAs.push(author.social_links.linkedin)\n if (author.social_links?.github) sameAs.push(`https://github.com/${author.social_links.github}`)\n\n // Deduplicate\n const uniqueSameAs = [...new Set(sameAs.filter(Boolean))]\n\n const schema: Record<string, any> = {\n '@context': 'https://schema.org',\n '@type': 'Person',\n name: author.name,\n url: author.author_page_url || `${siteUrl}/blog/author/${author.slug}`,\n }\n\n if (author.title) schema.jobTitle = author.title\n if (author.company || siteName) {\n schema.worksFor = {\n '@type': 'Organization',\n name: author.company || siteName,\n ...(siteUrl ? { url: siteUrl } : {}),\n }\n }\n if (author.bio || author.short_bio) schema.description = author.short_bio || author.bio\n if (author.avatar_url) schema.image = author.avatar_url\n if (uniqueSameAs.length > 0) schema.sameAs = uniqueSameAs\n if (author.knows_about && author.knows_about.length > 0) schema.knowsAbout = author.knows_about\n if (author.credentials && author.credentials.length > 0) {\n schema.hasCredential = author.credentials.map((c) => ({\n '@type': 'EducationalOccupationalCredential',\n credentialCategory: c,\n }))\n }\n\n return schema\n}\n\n// -----------------------------------------------------------------------------\n// Blog UI (BlogPost, BlogList) lives in `@sonordev/site-kit/blog/server-ui`.\n// This entry must stay free of React components so Next never marks server\n// helpers (e.g. getAllBlogSlugs) as client — see tsup onSuccess \"use client\".\n// -----------------------------------------------------------------------------\n\n/** Portal blog post document shape (alias of `BlogPost` from `./types`) */\nexport type { BlogPost as BlogPostRecord } from './types'\n"]}
|