@xexr/blog-platform 1.0.11 → 1.0.13
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/README.md +22 -28
- package/dist/app/api/blog/publish/route.ts +8 -4
- package/dist/app/api/blog/slugs/[slug]/route.ts +8 -5
- package/dist/app/api/blog/unpublish/route.ts +8 -4
- package/dist/app/api/blog/version/route.ts +8 -4
- package/dist/app/blog/[slug]/page.tsx +7 -1
- package/dist/app/blog/authors/[slug]/page.test.ts +3 -0
- package/dist/app/blog/authors/[slug]/page.tsx +11 -2
- package/dist/app/blog/page.test.ts +45 -0
- package/dist/app/blog/page.tsx +66 -12
- package/dist/components/ArticleReadingProgress.tsx +118 -87
- package/dist/components/AuthorPages.test.ts +3 -0
- package/dist/components/AuthorPages.tsx +10 -2
- package/dist/components/TopicArchivePages.test.ts +79 -0
- package/dist/components/TopicArchivePages.tsx +16 -3
- package/dist/index.d.mts +4 -410
- package/dist/index.d.ts +4 -410
- package/dist/index.js +9 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -84
- package/dist/index.mjs.map +1 -1
- package/dist/lib/article-ui.ts +3 -0
- package/dist/lib/auth.ts +6 -2
- package/dist/lib/sitemap.ts +115 -7
- package/dist/sitemap-BPTdXb9C.d.ts +422 -0
- package/dist/sitemap-Dz9DB7py.d.mts +422 -0
- package/dist/sitemap.d.mts +2 -0
- package/dist/sitemap.d.ts +2 -0
- package/dist/sitemap.js +6 -0
- package/dist/sitemap.js.map +1 -0
- package/dist/sitemap.mjs +6 -0
- package/dist/sitemap.mjs.map +1 -0
- package/package.json +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { ClassValue } from 'clsx';
|
|
|
9
9
|
import { NextRequest, NextResponse } from 'next/server';
|
|
10
10
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
11
11
|
import { LibSQLDatabase } from 'drizzle-orm/libsql';
|
|
12
|
+
import { C as CanonicalUrlOptions } from './sitemap-BPTdXb9C.js';
|
|
13
|
+
export { B as BlogSitemapConfig, N as NextjsSitemapEntry, S as SitemapChangeFreq, a as SitemapData, b as SitemapEntry, c as SitemapOptions, d as createBlogSitemapRoute, e as createDynamicBlogSitemap, g as generateBlogSitemapEntries, f as generateCanonicalUrl, h as generateCanonicalUrlFromSlug, i as generateSitemap, j as generateSitemapIndex, k as getBaseUrl, l as isValidCanonicalUrl, n as normalizeDomain, m as normalizeSlug, s as sitemapToXml, u as updateArticleCanonicalUrl, v as validateSitemap } from './sitemap-BPTdXb9C.js';
|
|
12
14
|
|
|
13
15
|
interface BlogTheme {
|
|
14
16
|
accentColor?: string;
|
|
@@ -464,6 +466,7 @@ interface AuthResult {
|
|
|
464
466
|
/** Additional user/context information */
|
|
465
467
|
context?: Record<string, unknown>;
|
|
466
468
|
}
|
|
469
|
+
declare function createTokenFingerprint(token: string): string;
|
|
467
470
|
/**
|
|
468
471
|
* Default token extraction from Authorization header
|
|
469
472
|
* Supports both "Bearer <token>" and "Token <token>" formats
|
|
@@ -1150,140 +1153,6 @@ declare function getDrizzleAdapterSql(): {
|
|
|
1150
1153
|
createOperations: string;
|
|
1151
1154
|
};
|
|
1152
1155
|
|
|
1153
|
-
/**
|
|
1154
|
-
* SEO utilities for canonical URL generation and validation.
|
|
1155
|
-
*
|
|
1156
|
-
* These utilities ensure proper canonical URL structure for SEO optimization,
|
|
1157
|
-
* preventing duplicate content issues and improving search engine indexing.
|
|
1158
|
-
*/
|
|
1159
|
-
|
|
1160
|
-
/**
|
|
1161
|
-
* Configuration options for canonical URL generation.
|
|
1162
|
-
*/
|
|
1163
|
-
interface CanonicalUrlOptions {
|
|
1164
|
-
/** Whether to force HTTPS protocol (default: true) */
|
|
1165
|
-
forceHttps?: boolean;
|
|
1166
|
-
/** Whether to remove trailing slashes (default: true) */
|
|
1167
|
-
removeTrailingSlash?: boolean;
|
|
1168
|
-
/** Custom domain override (uses site.domain if not provided) */
|
|
1169
|
-
domain?: string;
|
|
1170
|
-
/** Custom path prefix (default: '/blog') */
|
|
1171
|
-
pathPrefix?: string;
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* Normalizes a domain by ensuring proper protocol and removing trailing slashes.
|
|
1175
|
-
*
|
|
1176
|
-
* @param domain - The domain to normalize
|
|
1177
|
-
* @param forceHttps - Whether to force HTTPS protocol
|
|
1178
|
-
* @returns The normalized domain
|
|
1179
|
-
*
|
|
1180
|
-
* @example
|
|
1181
|
-
* ```typescript
|
|
1182
|
-
* normalizeDomain('example.com') // 'https://example.com'
|
|
1183
|
-
* normalizeDomain('http://example.com/') // 'https://example.com'
|
|
1184
|
-
* normalizeDomain('https://example.com', false) // 'https://example.com'
|
|
1185
|
-
* ```
|
|
1186
|
-
*/
|
|
1187
|
-
declare function normalizeDomain(domain: string, forceHttps?: boolean): string;
|
|
1188
|
-
/**
|
|
1189
|
-
* Validates and normalizes a slug for URL usage.
|
|
1190
|
-
*
|
|
1191
|
-
* @param slug - The slug to validate and normalize
|
|
1192
|
-
* @returns The normalized slug
|
|
1193
|
-
* @throws Error if slug is invalid
|
|
1194
|
-
*
|
|
1195
|
-
* @example
|
|
1196
|
-
* ```typescript
|
|
1197
|
-
* normalizeSlug('hello-world') // 'hello-world'
|
|
1198
|
-
* normalizeSlug('Hello World!') // throws Error
|
|
1199
|
-
* normalizeSlug('hello--world') // 'hello-world'
|
|
1200
|
-
* ```
|
|
1201
|
-
*/
|
|
1202
|
-
declare function normalizeSlug(slug: string): string;
|
|
1203
|
-
/**
|
|
1204
|
-
* Generates a canonical URL for an article.
|
|
1205
|
-
*
|
|
1206
|
-
* @param article - The published article
|
|
1207
|
-
* @param options - Configuration options for URL generation
|
|
1208
|
-
* @returns The canonical URL
|
|
1209
|
-
* @throws Error if article or site data is invalid
|
|
1210
|
-
*
|
|
1211
|
-
* @example
|
|
1212
|
-
* ```typescript
|
|
1213
|
-
* const article = {
|
|
1214
|
-
* slug: 'hello-world',
|
|
1215
|
-
* site: { domain: 'example.com' },
|
|
1216
|
-
* // ... other fields
|
|
1217
|
-
* };
|
|
1218
|
-
*
|
|
1219
|
-
* generateCanonicalUrl(article)
|
|
1220
|
-
* // 'https://example.com/blog/hello-world'
|
|
1221
|
-
*
|
|
1222
|
-
* generateCanonicalUrl(article, { pathPrefix: '/posts' })
|
|
1223
|
-
* // 'https://example.com/posts/hello-world'
|
|
1224
|
-
* ```
|
|
1225
|
-
*/
|
|
1226
|
-
declare function generateCanonicalUrl(article: PublishedArticle, options?: CanonicalUrlOptions): string;
|
|
1227
|
-
/**
|
|
1228
|
-
* Generates a canonical URL for an article from site and slug data.
|
|
1229
|
-
* Useful when you don't have a full PublishedArticle object.
|
|
1230
|
-
*
|
|
1231
|
-
* @param site - The published site
|
|
1232
|
-
* @param slug - The article slug
|
|
1233
|
-
* @param options - Configuration options for URL generation
|
|
1234
|
-
* @returns The canonical URL
|
|
1235
|
-
*
|
|
1236
|
-
* @example
|
|
1237
|
-
* ```typescript
|
|
1238
|
-
* const site = { domain: 'example.com', ... };
|
|
1239
|
-
* generateCanonicalUrlFromSlug(site, 'hello-world')
|
|
1240
|
-
* // 'https://example.com/blog/hello-world'
|
|
1241
|
-
* ```
|
|
1242
|
-
*/
|
|
1243
|
-
declare function generateCanonicalUrlFromSlug(site: PublishedSite, slug: string, options?: CanonicalUrlOptions): string;
|
|
1244
|
-
/**
|
|
1245
|
-
* Validates if a URL is a valid canonical URL format.
|
|
1246
|
-
*
|
|
1247
|
-
* @param url - The URL to validate
|
|
1248
|
-
* @returns True if the URL is valid for canonical use
|
|
1249
|
-
*
|
|
1250
|
-
* @example
|
|
1251
|
-
* ```typescript
|
|
1252
|
-
* isValidCanonicalUrl('https://example.com/blog/hello-world') // true
|
|
1253
|
-
* isValidCanonicalUrl('http://example.com/blog/hello-world') // true
|
|
1254
|
-
* isValidCanonicalUrl('example.com/blog/hello-world') // false (missing protocol)
|
|
1255
|
-
* isValidCanonicalUrl('https://example.com/blog/hello world') // false (spaces)
|
|
1256
|
-
* ```
|
|
1257
|
-
*/
|
|
1258
|
-
declare function isValidCanonicalUrl(url: string): boolean;
|
|
1259
|
-
/**
|
|
1260
|
-
* Extracts the base URL (protocol + hostname + port) from a canonical URL.
|
|
1261
|
-
*
|
|
1262
|
-
* @param canonicalUrl - The canonical URL
|
|
1263
|
-
* @returns The base URL
|
|
1264
|
-
*
|
|
1265
|
-
* @example
|
|
1266
|
-
* ```typescript
|
|
1267
|
-
* getBaseUrl('https://example.com/blog/hello-world') // 'https://example.com'
|
|
1268
|
-
* getBaseUrl('https://blog.example.com:8080/posts/test') // 'https://blog.example.com:8080'
|
|
1269
|
-
* ```
|
|
1270
|
-
*/
|
|
1271
|
-
declare function getBaseUrl(canonicalUrl: string): string;
|
|
1272
|
-
/**
|
|
1273
|
-
* Updates an article's canonical URL in its meta field.
|
|
1274
|
-
*
|
|
1275
|
-
* @param article - The article to update
|
|
1276
|
-
* @param options - Configuration options for URL generation
|
|
1277
|
-
* @returns A new article object with updated canonical URL
|
|
1278
|
-
*
|
|
1279
|
-
* @example
|
|
1280
|
-
* ```typescript
|
|
1281
|
-
* const updatedArticle = updateArticleCanonicalUrl(article);
|
|
1282
|
-
* console.log(updatedArticle.meta.canonicalUrl); // Generated canonical URL
|
|
1283
|
-
* ```
|
|
1284
|
-
*/
|
|
1285
|
-
declare function updateArticleCanonicalUrl(article: PublishedArticle, options?: CanonicalUrlOptions): PublishedArticle;
|
|
1286
|
-
|
|
1287
1156
|
/**
|
|
1288
1157
|
* Metadata generation utilities for SEO meta tags, OpenGraph, and Twitter Cards.
|
|
1289
1158
|
*
|
|
@@ -1429,281 +1298,6 @@ declare function validateMetadata(metadata: GeneratedMetadata): {
|
|
|
1429
1298
|
warnings: string[];
|
|
1430
1299
|
};
|
|
1431
1300
|
|
|
1432
|
-
/**
|
|
1433
|
-
* Next.js-compatible sitemap generation utilities for blog platform integration.
|
|
1434
|
-
*
|
|
1435
|
-
* These utilities generate sitemap entries that follow Next.js MetadataRoute.Sitemap
|
|
1436
|
-
* conventions, allowing seamless integration with existing Next.js applications.
|
|
1437
|
-
*
|
|
1438
|
-
* @example Integration with existing Next.js sitemap:
|
|
1439
|
-
* ```typescript
|
|
1440
|
-
* // app/sitemap.ts
|
|
1441
|
-
* import { generateBlogSitemapEntries } from '@xexr/blog-platform';
|
|
1442
|
-
* import type { MetadataRoute } from 'next';
|
|
1443
|
-
*
|
|
1444
|
-
* export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
1445
|
-
* // Your existing routes
|
|
1446
|
-
* const staticRoutes = [
|
|
1447
|
-
* { url: 'https://yoursite.com', lastModified: new Date(), priority: 1 },
|
|
1448
|
-
* { url: 'https://yoursite.com/about', lastModified: new Date(), priority: 0.8 }
|
|
1449
|
-
* ];
|
|
1450
|
-
*
|
|
1451
|
-
* // Blog platform entries
|
|
1452
|
-
* const blogEntries = await generateBlogSitemapEntries(blogConfig);
|
|
1453
|
-
*
|
|
1454
|
-
* return [...staticRoutes, ...blogEntries];
|
|
1455
|
-
* }
|
|
1456
|
-
* ```
|
|
1457
|
-
*/
|
|
1458
|
-
|
|
1459
|
-
/**
|
|
1460
|
-
* Configuration options for sitemap generation.
|
|
1461
|
-
*/
|
|
1462
|
-
interface SitemapOptions {
|
|
1463
|
-
/** Canonical URL configuration */
|
|
1464
|
-
canonical?: CanonicalUrlOptions;
|
|
1465
|
-
/** Whether to include author pages in sitemap */
|
|
1466
|
-
includeAuthorPages?: boolean;
|
|
1467
|
-
/** Whether to include pagination pages in sitemap */
|
|
1468
|
-
includePaginationPages?: boolean;
|
|
1469
|
-
/** Number of articles per page for pagination calculation */
|
|
1470
|
-
articlesPerPage?: number;
|
|
1471
|
-
/** Maximum number of sitemap entries (defaults to 50,000 per Google guidelines) */
|
|
1472
|
-
maxEntries?: number;
|
|
1473
|
-
/** Change frequency for different page types */
|
|
1474
|
-
changeFrequency?: {
|
|
1475
|
-
/** Change frequency for blog home page */
|
|
1476
|
-
homePage?: SitemapChangeFreq;
|
|
1477
|
-
/** Change frequency for article pages */
|
|
1478
|
-
articles?: SitemapChangeFreq;
|
|
1479
|
-
/** Change frequency for author pages */
|
|
1480
|
-
authorPages?: SitemapChangeFreq;
|
|
1481
|
-
/** Change frequency for pagination pages */
|
|
1482
|
-
paginationPages?: SitemapChangeFreq;
|
|
1483
|
-
};
|
|
1484
|
-
/** Priority values for different page types */
|
|
1485
|
-
priority?: {
|
|
1486
|
-
/** Priority for blog home page (0.0-1.0) */
|
|
1487
|
-
homePage?: number;
|
|
1488
|
-
/** Priority for article pages (0.0-1.0) */
|
|
1489
|
-
articles?: number;
|
|
1490
|
-
/** Priority for author pages (0.0-1.0) */
|
|
1491
|
-
authorPages?: number;
|
|
1492
|
-
/** Priority for pagination pages (0.0-1.0) */
|
|
1493
|
-
paginationPages?: number;
|
|
1494
|
-
};
|
|
1495
|
-
}
|
|
1496
|
-
/**
|
|
1497
|
-
* Valid sitemap change frequency values as per XML sitemap standard.
|
|
1498
|
-
*/
|
|
1499
|
-
type SitemapChangeFreq = "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
|
|
1500
|
-
/**
|
|
1501
|
-
* Next.js MetadataRoute.Sitemap compatible entry.
|
|
1502
|
-
* This matches the expected format for Next.js sitemap generation.
|
|
1503
|
-
*/
|
|
1504
|
-
interface NextjsSitemapEntry {
|
|
1505
|
-
/** The URL of the page */
|
|
1506
|
-
url: string;
|
|
1507
|
-
/** Last modification date */
|
|
1508
|
-
lastModified?: string | Date;
|
|
1509
|
-
/** Change frequency hint for search engines */
|
|
1510
|
-
changeFrequency?: SitemapChangeFreq;
|
|
1511
|
-
/** Priority relative to other URLs on the site (0.0-1.0) */
|
|
1512
|
-
priority?: number;
|
|
1513
|
-
/** Alternate language versions (for i18n) */
|
|
1514
|
-
alternates?: {
|
|
1515
|
-
languages?: Record<string, string>;
|
|
1516
|
-
};
|
|
1517
|
-
}
|
|
1518
|
-
/**
|
|
1519
|
-
* Legacy XML sitemap entry format (for backward compatibility).
|
|
1520
|
-
* @deprecated Use NextjsSitemapEntry for new implementations
|
|
1521
|
-
*/
|
|
1522
|
-
interface SitemapEntry {
|
|
1523
|
-
/** The URL of the page */
|
|
1524
|
-
loc: string;
|
|
1525
|
-
/** Last modification date as ISO 8601 string */
|
|
1526
|
-
lastmod?: string;
|
|
1527
|
-
/** Change frequency hint for search engines */
|
|
1528
|
-
changefreq?: SitemapChangeFreq;
|
|
1529
|
-
/** Priority relative to other URLs on the site (0.0-1.0) */
|
|
1530
|
-
priority?: number;
|
|
1531
|
-
}
|
|
1532
|
-
/**
|
|
1533
|
-
* Complete sitemap data structure.
|
|
1534
|
-
*/
|
|
1535
|
-
interface SitemapData {
|
|
1536
|
-
/** All URL entries in the sitemap */
|
|
1537
|
-
entries: SitemapEntry[];
|
|
1538
|
-
/** Total number of entries */
|
|
1539
|
-
totalEntries: number;
|
|
1540
|
-
/** Whether the sitemap was truncated due to size limits */
|
|
1541
|
-
truncated: boolean;
|
|
1542
|
-
/** Generation timestamp */
|
|
1543
|
-
generatedAt: string;
|
|
1544
|
-
/** Base URL used for canonical URL generation */
|
|
1545
|
-
baseUrl: string;
|
|
1546
|
-
}
|
|
1547
|
-
/**
|
|
1548
|
-
* Generates Next.js-compatible sitemap entries for blog platform integration.
|
|
1549
|
-
*
|
|
1550
|
-
* @param site - The published site information
|
|
1551
|
-
* @param articles - Array of published articles
|
|
1552
|
-
* @param authors - Array of published authors (optional)
|
|
1553
|
-
* @param options - Sitemap generation options
|
|
1554
|
-
* @returns Array of Next.js MetadataRoute.Sitemap compatible entries
|
|
1555
|
-
*
|
|
1556
|
-
* @example
|
|
1557
|
-
* ```typescript
|
|
1558
|
-
* // In your Next.js app/sitemap.ts file:
|
|
1559
|
-
* import { generateBlogSitemapEntries } from '@xexr/blog-platform';
|
|
1560
|
-
* import type { MetadataRoute } from 'next';
|
|
1561
|
-
*
|
|
1562
|
-
* export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
1563
|
-
* const blogEntries = await generateBlogSitemapEntries(site, articles, authors, {
|
|
1564
|
-
* includeAuthorPages: true,
|
|
1565
|
-
* includePaginationPages: true,
|
|
1566
|
-
* changeFrequency: { articles: 'monthly' }
|
|
1567
|
-
* });
|
|
1568
|
-
*
|
|
1569
|
-
* return [
|
|
1570
|
-
* // Your existing site routes
|
|
1571
|
-
* { url: 'https://yoursite.com', lastModified: new Date(), priority: 1 },
|
|
1572
|
-
* { url: 'https://yoursite.com/about', lastModified: new Date() },
|
|
1573
|
-
* // Blog entries
|
|
1574
|
-
* ...blogEntries
|
|
1575
|
-
* ];
|
|
1576
|
-
* }
|
|
1577
|
-
* ```
|
|
1578
|
-
*/
|
|
1579
|
-
declare function generateBlogSitemapEntries(site: PublishedSite, articles: readonly PublishedArticle[], authors?: readonly PublishedAuthor[], options?: SitemapOptions): Promise<NextjsSitemapEntry[]>;
|
|
1580
|
-
/**
|
|
1581
|
-
* Legacy sitemap generation for backward compatibility.
|
|
1582
|
-
* @deprecated Use generateBlogSitemapEntries for Next.js integration
|
|
1583
|
-
*
|
|
1584
|
-
* @param site - The published site information
|
|
1585
|
-
* @param articles - Array of published articles
|
|
1586
|
-
* @param authors - Array of published authors (optional)
|
|
1587
|
-
* @param options - Sitemap generation options
|
|
1588
|
-
* @returns Complete sitemap data
|
|
1589
|
-
*/
|
|
1590
|
-
declare function generateSitemap(site: PublishedSite, articles: readonly PublishedArticle[], authors?: readonly PublishedAuthor[], options?: SitemapOptions): SitemapData;
|
|
1591
|
-
/**
|
|
1592
|
-
* Converts sitemap data to XML format.
|
|
1593
|
-
*
|
|
1594
|
-
* @param sitemapData - The sitemap data to convert
|
|
1595
|
-
* @returns XML string in sitemap format
|
|
1596
|
-
*
|
|
1597
|
-
* @example
|
|
1598
|
-
* ```typescript
|
|
1599
|
-
* const sitemap = generateSitemap(site, articles);
|
|
1600
|
-
* const xmlString = sitemapToXml(sitemap);
|
|
1601
|
-
* // Use in API route response
|
|
1602
|
-
* ```
|
|
1603
|
-
*/
|
|
1604
|
-
declare function sitemapToXml(sitemapData: SitemapData): string;
|
|
1605
|
-
/**
|
|
1606
|
-
* Generates a sitemap index for large blogs that need multiple sitemaps.
|
|
1607
|
-
*
|
|
1608
|
-
* @param sitemaps - Array of sitemap information
|
|
1609
|
-
* @param baseUrl - Base URL for the site
|
|
1610
|
-
* @returns XML string for sitemap index
|
|
1611
|
-
*
|
|
1612
|
-
* @example
|
|
1613
|
-
* ```typescript
|
|
1614
|
-
* const sitemapIndex = generateSitemapIndex([
|
|
1615
|
-
* { url: 'https://example.com/sitemap-articles.xml', lastmod: '2023-01-01T00:00:00Z' },
|
|
1616
|
-
* { url: 'https://example.com/sitemap-authors.xml', lastmod: '2023-01-01T00:00:00Z' }
|
|
1617
|
-
* ], 'https://example.com');
|
|
1618
|
-
* ```
|
|
1619
|
-
*/
|
|
1620
|
-
declare function generateSitemapIndex(sitemaps: readonly {
|
|
1621
|
-
url: string;
|
|
1622
|
-
lastmod?: string;
|
|
1623
|
-
}[], _baseUrl: string): string;
|
|
1624
|
-
/**
|
|
1625
|
-
* Validates sitemap data for compliance with search engine guidelines.
|
|
1626
|
-
*
|
|
1627
|
-
* @param sitemapData - The sitemap data to validate
|
|
1628
|
-
* @returns Validation results with errors and warnings
|
|
1629
|
-
*
|
|
1630
|
-
* @example
|
|
1631
|
-
* ```typescript
|
|
1632
|
-
* const sitemap = generateSitemap(site, articles);
|
|
1633
|
-
* const validation = validateSitemap(sitemap);
|
|
1634
|
-
*
|
|
1635
|
-
* if (validation.errors.length > 0) {
|
|
1636
|
-
* console.error('Sitemap errors:', validation.errors);
|
|
1637
|
-
* }
|
|
1638
|
-
* ```
|
|
1639
|
-
*/
|
|
1640
|
-
declare function validateSitemap(sitemapData: SitemapData): {
|
|
1641
|
-
valid: boolean;
|
|
1642
|
-
errors: string[];
|
|
1643
|
-
warnings: string[];
|
|
1644
|
-
};
|
|
1645
|
-
/**
|
|
1646
|
-
* Creates a separate sitemap specifically for blog content.
|
|
1647
|
-
* Useful for large sites that need to split sitemaps by content type.
|
|
1648
|
-
*
|
|
1649
|
-
* @param site - The published site information
|
|
1650
|
-
* @param articles - Array of published articles
|
|
1651
|
-
* @param authors - Array of published authors (optional)
|
|
1652
|
-
* @param options - Sitemap generation options
|
|
1653
|
-
* @returns Next.js sitemap function
|
|
1654
|
-
*
|
|
1655
|
-
* @example
|
|
1656
|
-
* ```typescript
|
|
1657
|
-
* // app/blog-sitemap/route.ts - separate blog sitemap endpoint
|
|
1658
|
-
* import { createBlogSitemapRoute } from '@xexr/blog-platform';
|
|
1659
|
-
*
|
|
1660
|
-
* export const GET = createBlogSitemapRoute(site, articles, authors, {
|
|
1661
|
-
* includeAuthorPages: true,
|
|
1662
|
-
* articlesPerPage: 20
|
|
1663
|
-
* });
|
|
1664
|
-
* ```
|
|
1665
|
-
*/
|
|
1666
|
-
declare function createBlogSitemapRoute(site: PublishedSite, articles: readonly PublishedArticle[], authors?: readonly PublishedAuthor[], options?: SitemapOptions): () => Promise<Response>;
|
|
1667
|
-
/**
|
|
1668
|
-
* Configuration interface for blog data fetching.
|
|
1669
|
-
* Used to fetch blog data for sitemap generation.
|
|
1670
|
-
*/
|
|
1671
|
-
interface BlogSitemapConfig {
|
|
1672
|
-
/** Function to fetch site data */
|
|
1673
|
-
getSite: () => Promise<PublishedSite>;
|
|
1674
|
-
/** Function to fetch published articles */
|
|
1675
|
-
getArticles: () => Promise<readonly PublishedArticle[]>;
|
|
1676
|
-
/** Function to fetch authors (optional) */
|
|
1677
|
-
getAuthors?: () => Promise<readonly PublishedAuthor[]>;
|
|
1678
|
-
/** Sitemap generation options */
|
|
1679
|
-
options?: SitemapOptions;
|
|
1680
|
-
}
|
|
1681
|
-
/**
|
|
1682
|
-
* Higher-order function that creates a Next.js sitemap function with data fetching.
|
|
1683
|
-
* Ideal for dynamic blog content that needs to be fetched at sitemap generation time.
|
|
1684
|
-
*
|
|
1685
|
-
* @param config - Configuration for fetching blog data
|
|
1686
|
-
* @returns Next.js sitemap function
|
|
1687
|
-
*
|
|
1688
|
-
* @example
|
|
1689
|
-
* ```typescript
|
|
1690
|
-
* // app/sitemap.ts
|
|
1691
|
-
* import { createDynamicBlogSitemap } from '@xexr/blog-platform';
|
|
1692
|
-
* import { getBlogData } from './lib/blog';
|
|
1693
|
-
*
|
|
1694
|
-
* export default createDynamicBlogSitemap({
|
|
1695
|
-
* getSite: () => getBlogData().site,
|
|
1696
|
-
* getArticles: () => getBlogData().articles,
|
|
1697
|
-
* getAuthors: () => getBlogData().authors,
|
|
1698
|
-
* options: {
|
|
1699
|
-
* includeAuthorPages: true,
|
|
1700
|
-
* changeFrequency: { articles: 'weekly' }
|
|
1701
|
-
* }
|
|
1702
|
-
* });
|
|
1703
|
-
* ```
|
|
1704
|
-
*/
|
|
1705
|
-
declare function createDynamicBlogSitemap(config: BlogSitemapConfig): () => Promise<NextjsSitemapEntry[]>;
|
|
1706
|
-
|
|
1707
1301
|
/**
|
|
1708
1302
|
* Structured Data (JSON-LD) utilities for SEO optimization
|
|
1709
1303
|
*
|
|
@@ -2012,4 +1606,4 @@ declare function OPTIONS(request: NextRequest): Promise<NextResponse>;
|
|
|
2012
1606
|
|
|
2013
1607
|
declare const PACKAGE_VERSION: string;
|
|
2014
1608
|
|
|
2015
|
-
export { ApiKeyAuth, type AuthConfig, type AuthResult, type AuthorArchive, type AuthorArchiveOptions, ArticlePage as BlogArticlePage, AuthorPage as BlogAuthorPage, BlogAuthorsIndexPage, BlogHomePage, type BlogPlatformConfig, type BlogPlatformStorage, type BlogPostingSchema, type
|
|
1609
|
+
export { ApiKeyAuth, type AuthConfig, type AuthResult, type AuthorArchive, type AuthorArchiveOptions, ArticlePage as BlogArticlePage, AuthorPage as BlogAuthorPage, BlogAuthorsIndexPage, BlogHomePage, type BlogPlatformConfig, type BlogPlatformStorage, type BlogPostingSchema, type BlogTheme, BlogTopicArchivePage, BlogTopicsIndexPage, type BreadcrumbListSchema, Button, CanonicalUrlOptions, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, DrizzleStorage, EnvAuth, type GeneratedMetadata, InMemoryStorage, type LinkTag, type MetaTag, type MetadataOptions, NEWSLETTER_SUCCESS_MESSAGE, NewsletterSignup, type NewsletterSignupProps, NoAuth, type OrganizationSchema, PACKAGE_VERSION, Pagination$1 as Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, type PersonSchema, PublishResult, PublishedArticle, PublishedAuthor, PublishedNewsletterSettings, PublishedSite, PublishedTopic, type RateLimitConfig, type RateLimitResult, Pagination as ShadcnPagination, StructuredDataError, type StructuredDataOptions, type TopicArchive, UninitializedAuth, type WebSiteSchema, autoConfigureRateLimit, bpArticles, bpOperations, buildAuthorPath, buildBlogPath, buttonVariants, checkRateLimit, cn, configureRateLimit, createRateLimitErrorResponse, createStructuredDataScript, createTokenFingerprint, enforceRateLimit, extractKeywordsFromArticle, extractTableOfContents, extractTokenFromHeader, formatArticleDateMeta, generateArticleMetadata, generateArticleStructuredData, generateAuthorPageMetadata, generateAuthorStructuredData, generateBlogHomeMetadata, generateBlogHomeStructuredData, generateBreadcrumbStructuredData, generateCompleteArticleStructuredData, generateOrganizationStructuredData, generatePaginationMetadata, generateSiteMetadata, generateWebSiteStructuredData, getAllTopics, getArticlePrimaryTopic, getAuthConfig, getAuthorArchive, getAuthorsFromArticles, getBlogThemeStyle, getDrizzleAdapterSql, getPathPrefixFromBlogUrl, getRateLimitHeaders, getStorage, getTopicArchive, initBlogPlatform, initBlogPlatformDev, initBlogPlatformOnce, initBlogPlatformProd, initEnvAuth, loadAuthorArchive, metadataToHtml, normalizeBlogBasePath, POST$1 as publishHandler, safeGenerateArticleStructuredData, setAuthConfig, setStorage, shouldSkipAuth, GET as slugExistsHandler, OPTIONS as slugExistsOptionsHandler, structuredDataToJsonLd, POST as unpublishHandler, usePagination, validateMetadata, validateStructuredData, GET$1 as versionHandler };
|