@fullstackdatasolutions/articles 0.8.2 → 0.10.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/CHANGELOG.md +237 -0
- package/README.md +209 -78
- package/dist/index.cjs +635 -274
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -56
- package/dist/index.d.ts +164 -56
- package/dist/index.js +614 -250
- package/dist/index.js.map +1 -1
- package/dist/nextjs.cjs +113 -38
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.d.cts +71 -0
- package/dist/nextjs.d.ts +71 -0
- package/dist/nextjs.js +113 -38
- package/dist/nextjs.js.map +1 -1
- package/dist/server.cjs +394 -52
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +96 -6
- package/dist/server.d.ts +96 -6
- package/dist/server.js +382 -52
- package/dist/server.js.map +1 -1
- package/package.json +8 -5
- package/src/ArticleContent.tsx +8 -3
- package/src/ArticleDetailHero.tsx +27 -2
- package/src/ArticleSchemas.tsx +27 -27
- package/src/AuthorArticlesPage.tsx +60 -0
- package/src/AuthorCard.tsx +112 -0
- package/src/AuthorDetailHero.tsx +56 -0
- package/src/Breadcrumb.tsx +78 -0
- package/src/CategoryArticlesPage.tsx +62 -11
- package/src/__tests__/ArticleContent.test.tsx +18 -2
- package/src/__tests__/ArticleDetailHero.test.tsx +21 -1
- package/src/__tests__/ArticleSchemas.test.tsx +47 -2
- package/src/__tests__/AuthorArticlesPage.test.tsx +74 -0
- package/src/__tests__/AuthorCard.test.tsx +98 -0
- package/src/__tests__/AuthorDetailHero.test.tsx +51 -0
- package/src/__tests__/CategoryArticlesPage.test.tsx +31 -5
- package/src/__tests__/authorUtils.test.ts +89 -0
- package/src/__tests__/markdown.test.ts +79 -3
- package/src/__tests__/renderMdx.test.tsx +57 -0
- package/src/__tests__/seoUtils-authors.test.ts +160 -0
- package/src/__tests__/seoUtils.test.ts +106 -0
- package/src/__tests__/server-articles.test.ts +174 -3
- package/src/articleTypes.ts +33 -0
- package/src/articlesConfig.ts +67 -0
- package/src/authorUtils.ts +95 -0
- package/src/index.ts +32 -9
- package/src/markdown.ts +67 -8
- package/src/renderMdx.tsx +6 -3
- package/src/seoUtils.ts +279 -6
- package/src/server-articles.ts +124 -34
- package/src/server.ts +21 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
+
interface TocItem {
|
|
4
|
+
id: string;
|
|
5
|
+
depth: number;
|
|
6
|
+
text: string;
|
|
7
|
+
}
|
|
8
|
+
interface FaqItem {
|
|
9
|
+
question: string;
|
|
10
|
+
answer: string;
|
|
11
|
+
}
|
|
12
|
+
interface HowToStep {
|
|
13
|
+
name: string;
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
interface Article {
|
|
17
|
+
slug: string;
|
|
18
|
+
title: string;
|
|
19
|
+
excerpt: string;
|
|
20
|
+
date?: string;
|
|
21
|
+
lastmod?: string;
|
|
22
|
+
author: string;
|
|
23
|
+
authors?: string[];
|
|
24
|
+
category: string;
|
|
25
|
+
categories: string[];
|
|
26
|
+
readTime: string;
|
|
27
|
+
featuredImage: string;
|
|
28
|
+
tags?: string[];
|
|
29
|
+
content?: string;
|
|
30
|
+
htmlContent?: string;
|
|
31
|
+
mdxSource?: string;
|
|
32
|
+
contentType?: 'md' | 'mdx';
|
|
33
|
+
draft?: boolean;
|
|
34
|
+
toc?: TocItem[];
|
|
35
|
+
faq?: FaqItem[];
|
|
36
|
+
howTo?: HowToStep[];
|
|
37
|
+
canonicalUrl?: string;
|
|
38
|
+
articleType?: string;
|
|
39
|
+
series?: string;
|
|
40
|
+
aiCrawl?: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface CategoryInfo {
|
|
43
|
+
name: string;
|
|
44
|
+
slug: string;
|
|
45
|
+
count: number;
|
|
46
|
+
featuredImage: string;
|
|
47
|
+
}
|
|
48
|
+
interface AuthorSocial {
|
|
49
|
+
website?: string;
|
|
50
|
+
facebook?: string;
|
|
51
|
+
twitter?: string;
|
|
52
|
+
x?: string;
|
|
53
|
+
linkedin?: string;
|
|
54
|
+
instagram?: string;
|
|
55
|
+
youtube?: string;
|
|
56
|
+
tiktok?: string;
|
|
57
|
+
github?: string;
|
|
58
|
+
bluesky?: string;
|
|
59
|
+
threads?: string;
|
|
60
|
+
mastodon?: string;
|
|
61
|
+
medium?: string;
|
|
62
|
+
newsletter?: string;
|
|
63
|
+
other?: Record<string, string>;
|
|
64
|
+
}
|
|
65
|
+
interface AuthorProfile {
|
|
66
|
+
name: string;
|
|
67
|
+
slug: string;
|
|
68
|
+
bio: string;
|
|
69
|
+
avatar?: string;
|
|
70
|
+
url?: string;
|
|
71
|
+
social?: AuthorSocial;
|
|
72
|
+
}
|
|
73
|
+
interface BreadcrumbItem {
|
|
74
|
+
name: string;
|
|
75
|
+
url?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
3
78
|
/** Keys for each renderable section of the articles listing page. */
|
|
4
79
|
type ArticlesSection = 'hero' | 'search' | 'featured' | 'latest' | 'categories' | 'newsletter';
|
|
5
80
|
/**
|
|
@@ -58,6 +133,41 @@ interface HeroConfig {
|
|
|
58
133
|
/** Subheading paragraph displayed beneath the title. Default: the built-in description. */
|
|
59
134
|
description?: string;
|
|
60
135
|
}
|
|
136
|
+
/** Controls how article body links set target/rel attributes. */
|
|
137
|
+
type LinkTargetStrategy = 'external-new-tab' | 'all-new-tab' | 'same-tab';
|
|
138
|
+
type ArticleBreadcrumbToken = 'home' | 'articles' | 'primaryCategory' | 'folderPath' | 'articleTitle';
|
|
139
|
+
type CategoryBreadcrumbToken = 'home' | 'articles' | 'category';
|
|
140
|
+
type AuthorBreadcrumbToken = 'home' | 'articles' | 'authors' | 'authorName';
|
|
141
|
+
interface CustomBreadcrumbItem {
|
|
142
|
+
/** Label displayed in the breadcrumb trail. */
|
|
143
|
+
name: string;
|
|
144
|
+
/** Custom URL. Relative paths are resolved against `siteUrl` by server builders. */
|
|
145
|
+
url: string;
|
|
146
|
+
}
|
|
147
|
+
type ArticleBreadcrumbEntry = ArticleBreadcrumbToken | CustomBreadcrumbItem;
|
|
148
|
+
type CategoryBreadcrumbEntry = CategoryBreadcrumbToken | CustomBreadcrumbItem;
|
|
149
|
+
type AuthorBreadcrumbEntry = AuthorBreadcrumbToken | CustomBreadcrumbItem;
|
|
150
|
+
interface BreadcrumbLabels {
|
|
151
|
+
home?: string;
|
|
152
|
+
articles?: string;
|
|
153
|
+
authors?: string;
|
|
154
|
+
}
|
|
155
|
+
interface BreadcrumbsConfig {
|
|
156
|
+
/** Set to false to hide visible breadcrumbs and breadcrumb JSON-LD generated by the helper builders. */
|
|
157
|
+
show?: boolean;
|
|
158
|
+
/** Separator used by the visible Breadcrumb component. Default: '>'. */
|
|
159
|
+
separator?: string;
|
|
160
|
+
/** Set to false to render visible breadcrumbs without JSON-LD. Default: true. */
|
|
161
|
+
showSchema?: boolean;
|
|
162
|
+
/** Article breadcrumb trail. Example: ['primaryCategory', { name: 'Guides', url: '/guides' }, 'articleTitle']. */
|
|
163
|
+
article?: ArticleBreadcrumbEntry[];
|
|
164
|
+
/** Category breadcrumb trail. Default: ['home', 'articles', 'category']. */
|
|
165
|
+
category?: CategoryBreadcrumbEntry[];
|
|
166
|
+
/** Author breadcrumb trail. Default: ['home', 'articles', 'authors', 'authorName']. */
|
|
167
|
+
author?: AuthorBreadcrumbEntry[];
|
|
168
|
+
/** Optional label overrides for built-in breadcrumb items. */
|
|
169
|
+
labels?: BreadcrumbLabels;
|
|
170
|
+
}
|
|
61
171
|
/** Top-level configuration object. Pass one instance to every library component. */
|
|
62
172
|
interface ArticlesConfig {
|
|
63
173
|
/** Canonical base URL of the site, used in metadata and JSON-LD. Example: `'https://yoursite.com'` */
|
|
@@ -93,60 +203,27 @@ interface ArticlesConfig {
|
|
|
93
203
|
showBackToArticles?: boolean;
|
|
94
204
|
/** Set to false to hide author names from UI and metadata. Default: true. */
|
|
95
205
|
showAuthor?: boolean;
|
|
206
|
+
/** Author profiles keyed by slug. Omit to keep plain string author display. */
|
|
207
|
+
authors?: Record<string, AuthorProfile>;
|
|
208
|
+
/** Author slug used when article frontmatter omits author fields. */
|
|
209
|
+
defaultAuthor?: string;
|
|
210
|
+
/** Set to false to disable copied author page routes in consuming apps. Default: true. */
|
|
211
|
+
showAuthorPage?: boolean;
|
|
212
|
+
/** Set to false to disable breadcrumbs, or pass a config object to customize breadcrumb trails. */
|
|
213
|
+
breadcrumbs?: false | BreadcrumbsConfig;
|
|
214
|
+
/** Article body link target behavior. Default: `'external-new-tab'`. */
|
|
215
|
+
linkTargetStrategy?: LinkTargetStrategy;
|
|
96
216
|
}
|
|
97
217
|
declare const DEFAULT_PAGE_SIZE = 6;
|
|
98
218
|
declare const DEFAULT_CATEGORIES_PAGE_SIZE = 8;
|
|
99
219
|
declare const DEFAULT_LAYOUT: ArticlesSection[];
|
|
220
|
+
declare function breadcrumbsAreEnabled(config: ArticlesConfig): boolean;
|
|
221
|
+
declare function getBreadcrumbsConfig(config: ArticlesConfig): BreadcrumbsConfig;
|
|
100
222
|
|
|
101
223
|
declare function ArticlesPage({ config }: Readonly<{
|
|
102
224
|
config: ArticlesConfig;
|
|
103
225
|
}>): react_jsx_runtime.JSX.Element;
|
|
104
226
|
|
|
105
|
-
interface TocItem {
|
|
106
|
-
id: string;
|
|
107
|
-
depth: number;
|
|
108
|
-
text: string;
|
|
109
|
-
}
|
|
110
|
-
interface FaqItem {
|
|
111
|
-
question: string;
|
|
112
|
-
answer: string;
|
|
113
|
-
}
|
|
114
|
-
interface HowToStep {
|
|
115
|
-
name: string;
|
|
116
|
-
text: string;
|
|
117
|
-
}
|
|
118
|
-
interface Article {
|
|
119
|
-
slug: string;
|
|
120
|
-
title: string;
|
|
121
|
-
excerpt: string;
|
|
122
|
-
date?: string;
|
|
123
|
-
lastmod?: string;
|
|
124
|
-
author: string;
|
|
125
|
-
category: string;
|
|
126
|
-
categories: string[];
|
|
127
|
-
readTime: string;
|
|
128
|
-
featuredImage: string;
|
|
129
|
-
tags?: string[];
|
|
130
|
-
content?: string;
|
|
131
|
-
htmlContent?: string;
|
|
132
|
-
mdxSource?: string;
|
|
133
|
-
contentType?: 'md' | 'mdx';
|
|
134
|
-
draft?: boolean;
|
|
135
|
-
toc?: TocItem[];
|
|
136
|
-
faq?: FaqItem[];
|
|
137
|
-
howTo?: HowToStep[];
|
|
138
|
-
canonicalUrl?: string;
|
|
139
|
-
articleType?: string;
|
|
140
|
-
series?: string;
|
|
141
|
-
aiCrawl?: boolean;
|
|
142
|
-
}
|
|
143
|
-
interface CategoryInfo {
|
|
144
|
-
name: string;
|
|
145
|
-
slug: string;
|
|
146
|
-
count: number;
|
|
147
|
-
featuredImage: string;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
227
|
type ArticleCardProps = Readonly<{
|
|
151
228
|
article: Article;
|
|
152
229
|
}>;
|
|
@@ -169,8 +246,9 @@ type ArticleDetailHeroProps = Readonly<{
|
|
|
169
246
|
categoryBasePath?: string;
|
|
170
247
|
showDate?: boolean;
|
|
171
248
|
showAuthor?: boolean;
|
|
249
|
+
authors?: AuthorProfile[];
|
|
172
250
|
}>;
|
|
173
|
-
declare function ArticleDetailHero({ article, categoryBasePath, showDate, showAuthor, }: ArticleDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
251
|
+
declare function ArticleDetailHero({ article, categoryBasePath, showDate, showAuthor, authors, }: ArticleDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
174
252
|
|
|
175
253
|
type ArticleSearchBarProps = Readonly<{
|
|
176
254
|
value: string;
|
|
@@ -207,28 +285,58 @@ type CategoryArticlesPageProps = Readonly<{
|
|
|
207
285
|
}>;
|
|
208
286
|
declare function CategoryArticlesPage({ category, articles, config }: CategoryArticlesPageProps): react_jsx_runtime.JSX.Element | null;
|
|
209
287
|
|
|
288
|
+
type AuthorArticlesPageProps = Readonly<{
|
|
289
|
+
author: AuthorProfile;
|
|
290
|
+
articles: Article[];
|
|
291
|
+
config: ArticlesConfig;
|
|
292
|
+
}>;
|
|
293
|
+
declare function AuthorArticlesPage({ author, articles, config }: AuthorArticlesPageProps): react_jsx_runtime.JSX.Element;
|
|
294
|
+
|
|
295
|
+
type AuthorCardProps = Readonly<{
|
|
296
|
+
author: AuthorProfile;
|
|
297
|
+
linkToPage?: boolean;
|
|
298
|
+
showBio?: boolean;
|
|
299
|
+
showSocial?: boolean;
|
|
300
|
+
}>;
|
|
301
|
+
declare function AuthorCard({ author, linkToPage, showBio, showSocial, }: AuthorCardProps): react_jsx_runtime.JSX.Element;
|
|
302
|
+
declare function AuthorSocialLinks({ author }: Readonly<{
|
|
303
|
+
author: AuthorProfile;
|
|
304
|
+
}>): react_jsx_runtime.JSX.Element | null;
|
|
305
|
+
|
|
306
|
+
type AuthorDetailHeroProps = Readonly<{
|
|
307
|
+
author: AuthorProfile;
|
|
308
|
+
articleCount?: number;
|
|
309
|
+
}>;
|
|
310
|
+
declare function AuthorDetailHero({ author, articleCount }: AuthorDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
311
|
+
|
|
312
|
+
type BreadcrumbProps = Readonly<{
|
|
313
|
+
items: BreadcrumbItem[];
|
|
314
|
+
className?: string;
|
|
315
|
+
showSchema?: boolean;
|
|
316
|
+
separator?: string;
|
|
317
|
+
}>;
|
|
318
|
+
declare function Breadcrumb({ items, className, showSchema, separator, }: BreadcrumbProps): react_jsx_runtime.JSX.Element | null;
|
|
319
|
+
declare function BreadcrumbSchema({ items }: Readonly<{
|
|
320
|
+
items: BreadcrumbItem[];
|
|
321
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
322
|
+
|
|
210
323
|
type ArticleSchemaProps = Readonly<{
|
|
211
324
|
article: Article;
|
|
212
325
|
articleUrl: string;
|
|
213
326
|
siteName: string;
|
|
214
327
|
showAuthor?: boolean;
|
|
328
|
+
authors?: AuthorProfile[];
|
|
215
329
|
}>;
|
|
216
|
-
declare function ArticleSchema({ article, articleUrl, siteName, showAuthor, }: ArticleSchemaProps): react_jsx_runtime.JSX.Element;
|
|
217
|
-
type BreadcrumbSchemaProps = Readonly<{
|
|
218
|
-
items: ReadonlyArray<{
|
|
219
|
-
name: string;
|
|
220
|
-
url: string;
|
|
221
|
-
}>;
|
|
222
|
-
}>;
|
|
223
|
-
declare function BreadcrumbSchema({ items }: BreadcrumbSchemaProps): react_jsx_runtime.JSX.Element;
|
|
330
|
+
declare function ArticleSchema({ article, articleUrl, siteName, showAuthor, authors, }: ArticleSchemaProps): react_jsx_runtime.JSX.Element;
|
|
224
331
|
type ArticleSEOProps = Readonly<{
|
|
225
332
|
article: Article;
|
|
226
333
|
articleUrl: string;
|
|
227
334
|
siteName: string;
|
|
228
335
|
siteLogo?: string;
|
|
229
336
|
showAuthor?: boolean;
|
|
337
|
+
authors?: AuthorProfile[];
|
|
230
338
|
}>;
|
|
231
|
-
declare function ArticleSEO({ article, articleUrl, siteName, siteLogo, showAuthor, }: ArticleSEOProps): react_jsx_runtime.JSX.Element;
|
|
339
|
+
declare function ArticleSEO({ article, articleUrl, siteName, siteLogo, showAuthor, authors, }: ArticleSEOProps): react_jsx_runtime.JSX.Element;
|
|
232
340
|
type FAQPageSchemaProps = Readonly<{
|
|
233
341
|
items: ReadonlyArray<{
|
|
234
342
|
question: string;
|
|
@@ -336,4 +444,4 @@ interface UseArticlesReturn {
|
|
|
336
444
|
}
|
|
337
445
|
declare function useArticles(): UseArticlesReturn;
|
|
338
446
|
|
|
339
|
-
export { type Article, ArticleBackLink, ArticleCard, ArticleCategoryGrid, type ArticleComment, type ArticleCommentWithReplies, ArticleDetailHero, ArticleNavigation, ArticleSEO, ArticleSchema, ArticleSearchBar, ArticleSocialShare, ArticleTOC, type ArticlesConfig, ArticlesHero, ArticlesPage, type ArticlesSection, type ArticlesTheme, BreadcrumbSchema, CategoryArticlesPage, type CategoryDescription, type CategoryInfo, CollectionPageSchema, CommentForm, CommentItem, CommentThread, type CommentsConfig, CommentsSection, DEFAULT_CATEGORIES_PAGE_SIZE, DEFAULT_LAYOUT, DEFAULT_PAGE_SIZE, FAQPageSchema, type FaqItem, FeaturedArticle, type HowToStep, LatestArticles, LatestArticlesSection, ScrollToTop, type TocItem, type UseArticlesReturn, useArticles };
|
|
447
|
+
export { type Article, ArticleBackLink, type ArticleBreadcrumbEntry, type ArticleBreadcrumbToken, ArticleCard, ArticleCategoryGrid, type ArticleComment, type ArticleCommentWithReplies, ArticleDetailHero, ArticleNavigation, ArticleSEO, ArticleSchema, ArticleSearchBar, ArticleSocialShare, ArticleTOC, type ArticlesConfig, ArticlesHero, ArticlesPage, type ArticlesSection, type ArticlesTheme, AuthorArticlesPage, type AuthorBreadcrumbEntry, type AuthorBreadcrumbToken, AuthorCard, AuthorDetailHero, type AuthorProfile, type AuthorSocial, AuthorSocialLinks, Breadcrumb, type BreadcrumbItem, type BreadcrumbLabels, BreadcrumbSchema, type BreadcrumbsConfig, CategoryArticlesPage, type CategoryBreadcrumbEntry, type CategoryBreadcrumbToken, type CategoryDescription, type CategoryInfo, CollectionPageSchema, CommentForm, CommentItem, CommentThread, type CommentsConfig, CommentsSection, type CustomBreadcrumbItem, DEFAULT_CATEGORIES_PAGE_SIZE, DEFAULT_LAYOUT, DEFAULT_PAGE_SIZE, FAQPageSchema, type FaqItem, FeaturedArticle, type HowToStep, LatestArticles, LatestArticlesSection, type LinkTargetStrategy, ScrollToTop, type TocItem, type UseArticlesReturn, breadcrumbsAreEnabled, getBreadcrumbsConfig, useArticles };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
+
interface TocItem {
|
|
4
|
+
id: string;
|
|
5
|
+
depth: number;
|
|
6
|
+
text: string;
|
|
7
|
+
}
|
|
8
|
+
interface FaqItem {
|
|
9
|
+
question: string;
|
|
10
|
+
answer: string;
|
|
11
|
+
}
|
|
12
|
+
interface HowToStep {
|
|
13
|
+
name: string;
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
interface Article {
|
|
17
|
+
slug: string;
|
|
18
|
+
title: string;
|
|
19
|
+
excerpt: string;
|
|
20
|
+
date?: string;
|
|
21
|
+
lastmod?: string;
|
|
22
|
+
author: string;
|
|
23
|
+
authors?: string[];
|
|
24
|
+
category: string;
|
|
25
|
+
categories: string[];
|
|
26
|
+
readTime: string;
|
|
27
|
+
featuredImage: string;
|
|
28
|
+
tags?: string[];
|
|
29
|
+
content?: string;
|
|
30
|
+
htmlContent?: string;
|
|
31
|
+
mdxSource?: string;
|
|
32
|
+
contentType?: 'md' | 'mdx';
|
|
33
|
+
draft?: boolean;
|
|
34
|
+
toc?: TocItem[];
|
|
35
|
+
faq?: FaqItem[];
|
|
36
|
+
howTo?: HowToStep[];
|
|
37
|
+
canonicalUrl?: string;
|
|
38
|
+
articleType?: string;
|
|
39
|
+
series?: string;
|
|
40
|
+
aiCrawl?: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface CategoryInfo {
|
|
43
|
+
name: string;
|
|
44
|
+
slug: string;
|
|
45
|
+
count: number;
|
|
46
|
+
featuredImage: string;
|
|
47
|
+
}
|
|
48
|
+
interface AuthorSocial {
|
|
49
|
+
website?: string;
|
|
50
|
+
facebook?: string;
|
|
51
|
+
twitter?: string;
|
|
52
|
+
x?: string;
|
|
53
|
+
linkedin?: string;
|
|
54
|
+
instagram?: string;
|
|
55
|
+
youtube?: string;
|
|
56
|
+
tiktok?: string;
|
|
57
|
+
github?: string;
|
|
58
|
+
bluesky?: string;
|
|
59
|
+
threads?: string;
|
|
60
|
+
mastodon?: string;
|
|
61
|
+
medium?: string;
|
|
62
|
+
newsletter?: string;
|
|
63
|
+
other?: Record<string, string>;
|
|
64
|
+
}
|
|
65
|
+
interface AuthorProfile {
|
|
66
|
+
name: string;
|
|
67
|
+
slug: string;
|
|
68
|
+
bio: string;
|
|
69
|
+
avatar?: string;
|
|
70
|
+
url?: string;
|
|
71
|
+
social?: AuthorSocial;
|
|
72
|
+
}
|
|
73
|
+
interface BreadcrumbItem {
|
|
74
|
+
name: string;
|
|
75
|
+
url?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
3
78
|
/** Keys for each renderable section of the articles listing page. */
|
|
4
79
|
type ArticlesSection = 'hero' | 'search' | 'featured' | 'latest' | 'categories' | 'newsletter';
|
|
5
80
|
/**
|
|
@@ -58,6 +133,41 @@ interface HeroConfig {
|
|
|
58
133
|
/** Subheading paragraph displayed beneath the title. Default: the built-in description. */
|
|
59
134
|
description?: string;
|
|
60
135
|
}
|
|
136
|
+
/** Controls how article body links set target/rel attributes. */
|
|
137
|
+
type LinkTargetStrategy = 'external-new-tab' | 'all-new-tab' | 'same-tab';
|
|
138
|
+
type ArticleBreadcrumbToken = 'home' | 'articles' | 'primaryCategory' | 'folderPath' | 'articleTitle';
|
|
139
|
+
type CategoryBreadcrumbToken = 'home' | 'articles' | 'category';
|
|
140
|
+
type AuthorBreadcrumbToken = 'home' | 'articles' | 'authors' | 'authorName';
|
|
141
|
+
interface CustomBreadcrumbItem {
|
|
142
|
+
/** Label displayed in the breadcrumb trail. */
|
|
143
|
+
name: string;
|
|
144
|
+
/** Custom URL. Relative paths are resolved against `siteUrl` by server builders. */
|
|
145
|
+
url: string;
|
|
146
|
+
}
|
|
147
|
+
type ArticleBreadcrumbEntry = ArticleBreadcrumbToken | CustomBreadcrumbItem;
|
|
148
|
+
type CategoryBreadcrumbEntry = CategoryBreadcrumbToken | CustomBreadcrumbItem;
|
|
149
|
+
type AuthorBreadcrumbEntry = AuthorBreadcrumbToken | CustomBreadcrumbItem;
|
|
150
|
+
interface BreadcrumbLabels {
|
|
151
|
+
home?: string;
|
|
152
|
+
articles?: string;
|
|
153
|
+
authors?: string;
|
|
154
|
+
}
|
|
155
|
+
interface BreadcrumbsConfig {
|
|
156
|
+
/** Set to false to hide visible breadcrumbs and breadcrumb JSON-LD generated by the helper builders. */
|
|
157
|
+
show?: boolean;
|
|
158
|
+
/** Separator used by the visible Breadcrumb component. Default: '>'. */
|
|
159
|
+
separator?: string;
|
|
160
|
+
/** Set to false to render visible breadcrumbs without JSON-LD. Default: true. */
|
|
161
|
+
showSchema?: boolean;
|
|
162
|
+
/** Article breadcrumb trail. Example: ['primaryCategory', { name: 'Guides', url: '/guides' }, 'articleTitle']. */
|
|
163
|
+
article?: ArticleBreadcrumbEntry[];
|
|
164
|
+
/** Category breadcrumb trail. Default: ['home', 'articles', 'category']. */
|
|
165
|
+
category?: CategoryBreadcrumbEntry[];
|
|
166
|
+
/** Author breadcrumb trail. Default: ['home', 'articles', 'authors', 'authorName']. */
|
|
167
|
+
author?: AuthorBreadcrumbEntry[];
|
|
168
|
+
/** Optional label overrides for built-in breadcrumb items. */
|
|
169
|
+
labels?: BreadcrumbLabels;
|
|
170
|
+
}
|
|
61
171
|
/** Top-level configuration object. Pass one instance to every library component. */
|
|
62
172
|
interface ArticlesConfig {
|
|
63
173
|
/** Canonical base URL of the site, used in metadata and JSON-LD. Example: `'https://yoursite.com'` */
|
|
@@ -93,60 +203,27 @@ interface ArticlesConfig {
|
|
|
93
203
|
showBackToArticles?: boolean;
|
|
94
204
|
/** Set to false to hide author names from UI and metadata. Default: true. */
|
|
95
205
|
showAuthor?: boolean;
|
|
206
|
+
/** Author profiles keyed by slug. Omit to keep plain string author display. */
|
|
207
|
+
authors?: Record<string, AuthorProfile>;
|
|
208
|
+
/** Author slug used when article frontmatter omits author fields. */
|
|
209
|
+
defaultAuthor?: string;
|
|
210
|
+
/** Set to false to disable copied author page routes in consuming apps. Default: true. */
|
|
211
|
+
showAuthorPage?: boolean;
|
|
212
|
+
/** Set to false to disable breadcrumbs, or pass a config object to customize breadcrumb trails. */
|
|
213
|
+
breadcrumbs?: false | BreadcrumbsConfig;
|
|
214
|
+
/** Article body link target behavior. Default: `'external-new-tab'`. */
|
|
215
|
+
linkTargetStrategy?: LinkTargetStrategy;
|
|
96
216
|
}
|
|
97
217
|
declare const DEFAULT_PAGE_SIZE = 6;
|
|
98
218
|
declare const DEFAULT_CATEGORIES_PAGE_SIZE = 8;
|
|
99
219
|
declare const DEFAULT_LAYOUT: ArticlesSection[];
|
|
220
|
+
declare function breadcrumbsAreEnabled(config: ArticlesConfig): boolean;
|
|
221
|
+
declare function getBreadcrumbsConfig(config: ArticlesConfig): BreadcrumbsConfig;
|
|
100
222
|
|
|
101
223
|
declare function ArticlesPage({ config }: Readonly<{
|
|
102
224
|
config: ArticlesConfig;
|
|
103
225
|
}>): react_jsx_runtime.JSX.Element;
|
|
104
226
|
|
|
105
|
-
interface TocItem {
|
|
106
|
-
id: string;
|
|
107
|
-
depth: number;
|
|
108
|
-
text: string;
|
|
109
|
-
}
|
|
110
|
-
interface FaqItem {
|
|
111
|
-
question: string;
|
|
112
|
-
answer: string;
|
|
113
|
-
}
|
|
114
|
-
interface HowToStep {
|
|
115
|
-
name: string;
|
|
116
|
-
text: string;
|
|
117
|
-
}
|
|
118
|
-
interface Article {
|
|
119
|
-
slug: string;
|
|
120
|
-
title: string;
|
|
121
|
-
excerpt: string;
|
|
122
|
-
date?: string;
|
|
123
|
-
lastmod?: string;
|
|
124
|
-
author: string;
|
|
125
|
-
category: string;
|
|
126
|
-
categories: string[];
|
|
127
|
-
readTime: string;
|
|
128
|
-
featuredImage: string;
|
|
129
|
-
tags?: string[];
|
|
130
|
-
content?: string;
|
|
131
|
-
htmlContent?: string;
|
|
132
|
-
mdxSource?: string;
|
|
133
|
-
contentType?: 'md' | 'mdx';
|
|
134
|
-
draft?: boolean;
|
|
135
|
-
toc?: TocItem[];
|
|
136
|
-
faq?: FaqItem[];
|
|
137
|
-
howTo?: HowToStep[];
|
|
138
|
-
canonicalUrl?: string;
|
|
139
|
-
articleType?: string;
|
|
140
|
-
series?: string;
|
|
141
|
-
aiCrawl?: boolean;
|
|
142
|
-
}
|
|
143
|
-
interface CategoryInfo {
|
|
144
|
-
name: string;
|
|
145
|
-
slug: string;
|
|
146
|
-
count: number;
|
|
147
|
-
featuredImage: string;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
227
|
type ArticleCardProps = Readonly<{
|
|
151
228
|
article: Article;
|
|
152
229
|
}>;
|
|
@@ -169,8 +246,9 @@ type ArticleDetailHeroProps = Readonly<{
|
|
|
169
246
|
categoryBasePath?: string;
|
|
170
247
|
showDate?: boolean;
|
|
171
248
|
showAuthor?: boolean;
|
|
249
|
+
authors?: AuthorProfile[];
|
|
172
250
|
}>;
|
|
173
|
-
declare function ArticleDetailHero({ article, categoryBasePath, showDate, showAuthor, }: ArticleDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
251
|
+
declare function ArticleDetailHero({ article, categoryBasePath, showDate, showAuthor, authors, }: ArticleDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
174
252
|
|
|
175
253
|
type ArticleSearchBarProps = Readonly<{
|
|
176
254
|
value: string;
|
|
@@ -207,28 +285,58 @@ type CategoryArticlesPageProps = Readonly<{
|
|
|
207
285
|
}>;
|
|
208
286
|
declare function CategoryArticlesPage({ category, articles, config }: CategoryArticlesPageProps): react_jsx_runtime.JSX.Element | null;
|
|
209
287
|
|
|
288
|
+
type AuthorArticlesPageProps = Readonly<{
|
|
289
|
+
author: AuthorProfile;
|
|
290
|
+
articles: Article[];
|
|
291
|
+
config: ArticlesConfig;
|
|
292
|
+
}>;
|
|
293
|
+
declare function AuthorArticlesPage({ author, articles, config }: AuthorArticlesPageProps): react_jsx_runtime.JSX.Element;
|
|
294
|
+
|
|
295
|
+
type AuthorCardProps = Readonly<{
|
|
296
|
+
author: AuthorProfile;
|
|
297
|
+
linkToPage?: boolean;
|
|
298
|
+
showBio?: boolean;
|
|
299
|
+
showSocial?: boolean;
|
|
300
|
+
}>;
|
|
301
|
+
declare function AuthorCard({ author, linkToPage, showBio, showSocial, }: AuthorCardProps): react_jsx_runtime.JSX.Element;
|
|
302
|
+
declare function AuthorSocialLinks({ author }: Readonly<{
|
|
303
|
+
author: AuthorProfile;
|
|
304
|
+
}>): react_jsx_runtime.JSX.Element | null;
|
|
305
|
+
|
|
306
|
+
type AuthorDetailHeroProps = Readonly<{
|
|
307
|
+
author: AuthorProfile;
|
|
308
|
+
articleCount?: number;
|
|
309
|
+
}>;
|
|
310
|
+
declare function AuthorDetailHero({ author, articleCount }: AuthorDetailHeroProps): react_jsx_runtime.JSX.Element;
|
|
311
|
+
|
|
312
|
+
type BreadcrumbProps = Readonly<{
|
|
313
|
+
items: BreadcrumbItem[];
|
|
314
|
+
className?: string;
|
|
315
|
+
showSchema?: boolean;
|
|
316
|
+
separator?: string;
|
|
317
|
+
}>;
|
|
318
|
+
declare function Breadcrumb({ items, className, showSchema, separator, }: BreadcrumbProps): react_jsx_runtime.JSX.Element | null;
|
|
319
|
+
declare function BreadcrumbSchema({ items }: Readonly<{
|
|
320
|
+
items: BreadcrumbItem[];
|
|
321
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
322
|
+
|
|
210
323
|
type ArticleSchemaProps = Readonly<{
|
|
211
324
|
article: Article;
|
|
212
325
|
articleUrl: string;
|
|
213
326
|
siteName: string;
|
|
214
327
|
showAuthor?: boolean;
|
|
328
|
+
authors?: AuthorProfile[];
|
|
215
329
|
}>;
|
|
216
|
-
declare function ArticleSchema({ article, articleUrl, siteName, showAuthor, }: ArticleSchemaProps): react_jsx_runtime.JSX.Element;
|
|
217
|
-
type BreadcrumbSchemaProps = Readonly<{
|
|
218
|
-
items: ReadonlyArray<{
|
|
219
|
-
name: string;
|
|
220
|
-
url: string;
|
|
221
|
-
}>;
|
|
222
|
-
}>;
|
|
223
|
-
declare function BreadcrumbSchema({ items }: BreadcrumbSchemaProps): react_jsx_runtime.JSX.Element;
|
|
330
|
+
declare function ArticleSchema({ article, articleUrl, siteName, showAuthor, authors, }: ArticleSchemaProps): react_jsx_runtime.JSX.Element;
|
|
224
331
|
type ArticleSEOProps = Readonly<{
|
|
225
332
|
article: Article;
|
|
226
333
|
articleUrl: string;
|
|
227
334
|
siteName: string;
|
|
228
335
|
siteLogo?: string;
|
|
229
336
|
showAuthor?: boolean;
|
|
337
|
+
authors?: AuthorProfile[];
|
|
230
338
|
}>;
|
|
231
|
-
declare function ArticleSEO({ article, articleUrl, siteName, siteLogo, showAuthor, }: ArticleSEOProps): react_jsx_runtime.JSX.Element;
|
|
339
|
+
declare function ArticleSEO({ article, articleUrl, siteName, siteLogo, showAuthor, authors, }: ArticleSEOProps): react_jsx_runtime.JSX.Element;
|
|
232
340
|
type FAQPageSchemaProps = Readonly<{
|
|
233
341
|
items: ReadonlyArray<{
|
|
234
342
|
question: string;
|
|
@@ -336,4 +444,4 @@ interface UseArticlesReturn {
|
|
|
336
444
|
}
|
|
337
445
|
declare function useArticles(): UseArticlesReturn;
|
|
338
446
|
|
|
339
|
-
export { type Article, ArticleBackLink, ArticleCard, ArticleCategoryGrid, type ArticleComment, type ArticleCommentWithReplies, ArticleDetailHero, ArticleNavigation, ArticleSEO, ArticleSchema, ArticleSearchBar, ArticleSocialShare, ArticleTOC, type ArticlesConfig, ArticlesHero, ArticlesPage, type ArticlesSection, type ArticlesTheme, BreadcrumbSchema, CategoryArticlesPage, type CategoryDescription, type CategoryInfo, CollectionPageSchema, CommentForm, CommentItem, CommentThread, type CommentsConfig, CommentsSection, DEFAULT_CATEGORIES_PAGE_SIZE, DEFAULT_LAYOUT, DEFAULT_PAGE_SIZE, FAQPageSchema, type FaqItem, FeaturedArticle, type HowToStep, LatestArticles, LatestArticlesSection, ScrollToTop, type TocItem, type UseArticlesReturn, useArticles };
|
|
447
|
+
export { type Article, ArticleBackLink, type ArticleBreadcrumbEntry, type ArticleBreadcrumbToken, ArticleCard, ArticleCategoryGrid, type ArticleComment, type ArticleCommentWithReplies, ArticleDetailHero, ArticleNavigation, ArticleSEO, ArticleSchema, ArticleSearchBar, ArticleSocialShare, ArticleTOC, type ArticlesConfig, ArticlesHero, ArticlesPage, type ArticlesSection, type ArticlesTheme, AuthorArticlesPage, type AuthorBreadcrumbEntry, type AuthorBreadcrumbToken, AuthorCard, AuthorDetailHero, type AuthorProfile, type AuthorSocial, AuthorSocialLinks, Breadcrumb, type BreadcrumbItem, type BreadcrumbLabels, BreadcrumbSchema, type BreadcrumbsConfig, CategoryArticlesPage, type CategoryBreadcrumbEntry, type CategoryBreadcrumbToken, type CategoryDescription, type CategoryInfo, CollectionPageSchema, CommentForm, CommentItem, CommentThread, type CommentsConfig, CommentsSection, type CustomBreadcrumbItem, DEFAULT_CATEGORIES_PAGE_SIZE, DEFAULT_LAYOUT, DEFAULT_PAGE_SIZE, FAQPageSchema, type FaqItem, FeaturedArticle, type HowToStep, LatestArticles, LatestArticlesSection, type LinkTargetStrategy, ScrollToTop, type TocItem, type UseArticlesReturn, breadcrumbsAreEnabled, getBreadcrumbsConfig, useArticles };
|