@fullstackdatasolutions/articles 0.4.2 → 0.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/README.md +138 -3
- package/dist/index.cjs +182 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +241 -110
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +281 -189
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +37 -1
- package/dist/server.d.ts +37 -1
- package/dist/server.js +278 -189
- package/dist/server.js.map +1 -1
- package/package.json +5 -1
- package/src/ArticleContent.tsx +17 -0
- package/src/ArticleSchemas.tsx +97 -1
- package/src/ArticleSocialShare.tsx +1 -1
- package/src/ArticleTOC.tsx +29 -0
- package/src/ScrollToTop.tsx +25 -0
- package/src/__tests__/ArticleContent.test.tsx +91 -0
- package/src/__tests__/ArticleSchemas.test.tsx +212 -1
- package/src/__tests__/ArticleSocialShare.test.tsx +7 -7
- package/src/__tests__/ArticleTOC.test.tsx +75 -0
- package/src/__tests__/ScrollToTop.test.tsx +87 -0
- package/src/__tests__/seoUtils.test.ts +284 -0
- package/src/__tests__/server-articles.test.ts +98 -0
- package/src/articleTypes.ts +26 -0
- package/src/articlesConfig.ts +4 -0
- package/src/index.ts +10 -2
- package/src/markdown.ts +143 -130
- package/src/seoUtils.ts +79 -15
- package/src/server-articles.ts +81 -78
- package/src/server.ts +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -85,6 +85,10 @@ interface ArticlesConfig {
|
|
|
85
85
|
comments?: CommentsConfig;
|
|
86
86
|
/** Hero section title and description. Omit to use the built-in defaults. */
|
|
87
87
|
hero?: HeroConfig;
|
|
88
|
+
/** Short description used in the RSS feed channel. Falls back to siteName if omitted. */
|
|
89
|
+
description?: string;
|
|
90
|
+
/** Set to false to hide the table of contents on article detail pages. Default: true. */
|
|
91
|
+
showToc?: boolean;
|
|
88
92
|
}
|
|
89
93
|
declare const DEFAULT_PAGE_SIZE = 6;
|
|
90
94
|
declare const DEFAULT_CATEGORIES_PAGE_SIZE = 8;
|
|
@@ -94,11 +98,25 @@ declare function ArticlesPage({ config }: Readonly<{
|
|
|
94
98
|
config: ArticlesConfig;
|
|
95
99
|
}>): react_jsx_runtime.JSX.Element;
|
|
96
100
|
|
|
101
|
+
interface TocItem {
|
|
102
|
+
id: string;
|
|
103
|
+
depth: number;
|
|
104
|
+
text: string;
|
|
105
|
+
}
|
|
106
|
+
interface FaqItem {
|
|
107
|
+
question: string;
|
|
108
|
+
answer: string;
|
|
109
|
+
}
|
|
110
|
+
interface HowToStep {
|
|
111
|
+
name: string;
|
|
112
|
+
text: string;
|
|
113
|
+
}
|
|
97
114
|
interface Article {
|
|
98
115
|
slug: string;
|
|
99
116
|
title: string;
|
|
100
117
|
excerpt: string;
|
|
101
118
|
date?: string;
|
|
119
|
+
lastmod?: string;
|
|
102
120
|
author: string;
|
|
103
121
|
category: string;
|
|
104
122
|
categories: string[];
|
|
@@ -107,6 +125,15 @@ interface Article {
|
|
|
107
125
|
tags?: string[];
|
|
108
126
|
content?: string;
|
|
109
127
|
htmlContent?: string;
|
|
128
|
+
mdxSource?: string;
|
|
129
|
+
contentType?: 'md' | 'mdx';
|
|
130
|
+
draft?: boolean;
|
|
131
|
+
toc?: TocItem[];
|
|
132
|
+
faq?: FaqItem[];
|
|
133
|
+
howTo?: HowToStep[];
|
|
134
|
+
canonicalUrl?: string;
|
|
135
|
+
articleType?: string;
|
|
136
|
+
series?: string;
|
|
110
137
|
}
|
|
111
138
|
interface CategoryInfo {
|
|
112
139
|
name: string;
|
|
@@ -186,6 +213,20 @@ type BreadcrumbSchemaProps = Readonly<{
|
|
|
186
213
|
}>;
|
|
187
214
|
}>;
|
|
188
215
|
declare function BreadcrumbSchema({ items }: BreadcrumbSchemaProps): react_jsx_runtime.JSX.Element;
|
|
216
|
+
type ArticleSEOProps = Readonly<{
|
|
217
|
+
article: Article;
|
|
218
|
+
articleUrl: string;
|
|
219
|
+
siteName: string;
|
|
220
|
+
siteLogo?: string;
|
|
221
|
+
}>;
|
|
222
|
+
declare function ArticleSEO({ article, articleUrl, siteName, siteLogo }: ArticleSEOProps): react_jsx_runtime.JSX.Element;
|
|
223
|
+
type FAQPageSchemaProps = Readonly<{
|
|
224
|
+
items: ReadonlyArray<{
|
|
225
|
+
question: string;
|
|
226
|
+
answer: string;
|
|
227
|
+
}>;
|
|
228
|
+
}>;
|
|
229
|
+
declare function FAQPageSchema({ items }: FAQPageSchemaProps): react_jsx_runtime.JSX.Element;
|
|
189
230
|
type CollectionPageSchemaProps = Readonly<{
|
|
190
231
|
title: string;
|
|
191
232
|
description: string;
|
|
@@ -215,6 +256,14 @@ interface ArticleNavigationProps {
|
|
|
215
256
|
}
|
|
216
257
|
declare function ArticleNavigation({ previous, next, basePath }: ArticleNavigationProps): react_jsx_runtime.JSX.Element | null;
|
|
217
258
|
|
|
259
|
+
type ArticleTOCProps = Readonly<{
|
|
260
|
+
toc: TocItem[];
|
|
261
|
+
className?: string;
|
|
262
|
+
}>;
|
|
263
|
+
declare function ArticleTOC({ toc, className }: ArticleTOCProps): react_jsx_runtime.JSX.Element | null;
|
|
264
|
+
|
|
265
|
+
declare function ScrollToTop(): react_jsx_runtime.JSX.Element | null;
|
|
266
|
+
|
|
218
267
|
interface CommentsSectionProps {
|
|
219
268
|
readonly articleSlug: string;
|
|
220
269
|
readonly config: CommentsConfig;
|
|
@@ -270,4 +319,4 @@ interface UseArticlesReturn {
|
|
|
270
319
|
}
|
|
271
320
|
declare function useArticles(): UseArticlesReturn;
|
|
272
321
|
|
|
273
|
-
export { type Article, ArticleCard, ArticleCategoryGrid, type ArticleComment, type ArticleCommentWithReplies, ArticleDetailHero, ArticleNavigation, ArticleSchema, ArticleSearchBar, ArticleSocialShare, 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, FeaturedArticle, LatestArticles, LatestArticlesSection, type UseArticlesReturn, useArticles };
|
|
322
|
+
export { type Article, 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 };
|