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