@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.
Files changed (51) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/README.md +209 -78
  3. package/dist/index.cjs +635 -274
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +164 -56
  6. package/dist/index.d.ts +164 -56
  7. package/dist/index.js +614 -250
  8. package/dist/index.js.map +1 -1
  9. package/dist/nextjs.cjs +113 -38
  10. package/dist/nextjs.cjs.map +1 -1
  11. package/dist/nextjs.d.cts +71 -0
  12. package/dist/nextjs.d.ts +71 -0
  13. package/dist/nextjs.js +113 -38
  14. package/dist/nextjs.js.map +1 -1
  15. package/dist/server.cjs +394 -52
  16. package/dist/server.cjs.map +1 -1
  17. package/dist/server.d.cts +96 -6
  18. package/dist/server.d.ts +96 -6
  19. package/dist/server.js +382 -52
  20. package/dist/server.js.map +1 -1
  21. package/package.json +8 -5
  22. package/src/ArticleContent.tsx +8 -3
  23. package/src/ArticleDetailHero.tsx +27 -2
  24. package/src/ArticleSchemas.tsx +27 -27
  25. package/src/AuthorArticlesPage.tsx +60 -0
  26. package/src/AuthorCard.tsx +112 -0
  27. package/src/AuthorDetailHero.tsx +56 -0
  28. package/src/Breadcrumb.tsx +78 -0
  29. package/src/CategoryArticlesPage.tsx +62 -11
  30. package/src/__tests__/ArticleContent.test.tsx +18 -2
  31. package/src/__tests__/ArticleDetailHero.test.tsx +21 -1
  32. package/src/__tests__/ArticleSchemas.test.tsx +47 -2
  33. package/src/__tests__/AuthorArticlesPage.test.tsx +74 -0
  34. package/src/__tests__/AuthorCard.test.tsx +98 -0
  35. package/src/__tests__/AuthorDetailHero.test.tsx +51 -0
  36. package/src/__tests__/CategoryArticlesPage.test.tsx +31 -5
  37. package/src/__tests__/authorUtils.test.ts +89 -0
  38. package/src/__tests__/markdown.test.ts +79 -3
  39. package/src/__tests__/renderMdx.test.tsx +57 -0
  40. package/src/__tests__/seoUtils-authors.test.ts +160 -0
  41. package/src/__tests__/seoUtils.test.ts +106 -0
  42. package/src/__tests__/server-articles.test.ts +174 -3
  43. package/src/articleTypes.ts +33 -0
  44. package/src/articlesConfig.ts +67 -0
  45. package/src/authorUtils.ts +95 -0
  46. package/src/index.ts +32 -9
  47. package/src/markdown.ts +67 -8
  48. package/src/renderMdx.tsx +6 -3
  49. package/src/seoUtils.ts +279 -6
  50. package/src/server-articles.ts +124 -34
  51. package/src/server.ts +21 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,237 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.10.0] - 2026-07-23
9
+
10
+ ### Added
11
+
12
+ - Added configured author profiles with social links, avatar support, default authors, and optional generated author pages.
13
+ - Added zero-author and multi-author article support via `authors: []` and `authors: [author-slug]` frontmatter while preserving the legacy `author` fallback.
14
+ - Added author social profile fields for website, Facebook, Twitter, X, LinkedIn, Instagram, YouTube, TikTok, GitHub, Bluesky, Threads, Mastodon, Medium, newsletter, and custom `other` links. Empty social fields are omitted from rendered author UI.
15
+ - Added author server utilities: `getAuthorBySlug`, `getArticleAuthors`, `getAllAuthors`, `getArticlesByAuthor`, `generateAuthorStaticParams`, and `generateAuthorMetadata`.
16
+ - Added `AuthorCard`, `AuthorDetailHero`, `AuthorArticlesPage`, and visible `Breadcrumb` components.
17
+ - Added optional breadcrumb builders for article, category, and author pages with configurable trails, custom URL entries at any position, folder-path expansion, label overrides, separators, and JSON-LD control.
18
+
19
+ ### Changed
20
+
21
+ - Article JSON-LD now emits full `Person` objects for configured authors.
22
+ - Article, category, search, feed, and sitemap helpers can resolve configured author display names when passed `ArticlesConfig`.
23
+ - The reference app now exposes `/articles/authors/[author]` pages, shows configured author bylines, and uses visible breadcrumbs on article and category routes.
24
+
25
+ ## [0.9.0] - 2026-07-06
26
+
27
+ ### Added
28
+
29
+ - Added `linkTargetStrategy` to `ArticlesConfig` with three article body link behaviors: `external-new-tab` (default), `all-new-tab`, and `same-tab`.
30
+ - Added `generateRssFeed(articles, config)` to the server exports so consuming apps can delegate RSS XML generation to the package.
31
+
32
+ ### Changed
33
+
34
+ - Article body links now default to opening internal links in the same window and external `http`/`https` links in a new window with `rel="noopener noreferrer"`.
35
+ - `getArticleMetadata(slug, config?)`, `ArticleContent`, and MDX rendering now accept article config so Markdown and MDX links share the same target behavior.
36
+ - The README article route examples now pass `siteConfig` into article metadata/content rendering, and the RSS route example uses `generateRssFeed`.
37
+
38
+ ## [0.8.2] - 2026-05-27
39
+
40
+ ### Added
41
+
42
+ - Added test coverage for `aiCrawl` wiring: robots.txt AI rules integration, markdown route handler (`GET /articles/[slug].md`), and `generateMetadata` aiCrawl behavior in the article detail page.
43
+
44
+ ### Documentation
45
+
46
+ - README: added concrete wiring examples for `aiCrawl` integration in consuming apps - `getAiRobotsTxtRules` usage in `robots.txt` route, `generateMetadata` alternates pattern for markdown alternate links, and `robots` string for `noai`/`noimageai` directives.
47
+ - README: added explicit warning that `headers()` from `next/headers` is read-only in Next.js App Router pages and cannot be used to set response headers - `getArticleAiHeaders` must only be called from Route Handlers.
48
+
49
+ ### Fixed
50
+
51
+ - Removed dead code in article detail page that referenced `headers()` and `getArticleAiHeaders` in a Server Component context, causing TypeScript errors.
52
+
53
+ ## [0.8.1] - 2026-06-01
54
+
55
+ ## [0.8.0] - 2026-05-26
56
+
57
+ ### Added
58
+
59
+ - Added `aiCrawl` article frontmatter support. Only articles with `aiCrawl: true` expose markdown twins, markdown alternate metadata, and markdown route helper responses.
60
+ - Added AI crawl server helpers: `getArticleMarkdown`, `getArticleMarkdownResponse`, `getArticleMarkdownUrl`, `getArticleAiHeaders`, and `getAiRobotsTxtRules`.
61
+ - Added `showAuthor` to `ArticlesConfig` to hide author names from UI, generated metadata, JSON-LD, RSS examples, and optional author search matching.
62
+ - Added `setArticlesErrorHandler` so installed apps can route article package errors to their own logging or observability system.
63
+
64
+ ### Dependencies
65
+
66
+ - `remark-github-blockquote-alert` updated from `^1.3.1` to `^2.1.0`
67
+
68
+ ## [0.7.2] - 2026-05-22
69
+
70
+ ### Added
71
+
72
+ - Added npm `funding` metadata pointing to the Buy Me a Coffee support page.
73
+ - Added a dependency-free `postinstall` message that thanks users for installing the package and links to the support page.
74
+
75
+ ## [0.7.1] - 2026-05-21
76
+
77
+ ### Fixed
78
+
79
+ - Internal anchor links (href starting with `#`) no longer open in a new tab. The `customRenderer` rehype plugin now checks for internal anchors before applying `target="_blank"` and `rel="noopener noreferrer"`.
80
+ - Article discovery now continues walking inside directories that are also articles, so nested articles at any depth are included in `getAllArticles()`, sitemap entries, RSS feeds, and static params.
81
+ - README route examples now use the catch-all `app/articles/[...slug]/page.tsx` pattern required for slash-separated nested article slugs.
82
+
83
+ ### Added
84
+
85
+ - `ArticleBackLink` component - renders a back-navigation link on article detail pages. Returns `null` when `config.showBackToArticles === false`. Accepts `config`, optional `href` (default `/articles`), optional `label` (default `Back to Articles`), and optional `className` props.
86
+ - Test coverage added across `markdown.ts`, `ArticleBackLink.tsx`, `articlesConfig.ts`, and `server-articles.ts`, including coverage for nested article discovery.
87
+
88
+ ## [0.7.0] - 2026-05-20
89
+
90
+ ### Added
91
+
92
+ - MDX articles now apply the same explicit Tailwind utility classes as Markdown articles. The shared `customRenderer` rehype plugin is passed to `evaluate()` so heading, paragraph, list, blockquote, code, table, and image elements are styled identically across both content types.
93
+ - MDX image resolution: relative `src` values in MDX articles are resolved to `/articles/{slug}/{filename}` at render time via an injected `img` component. Absolute URLs and paths starting with `/` are left unchanged.
94
+ - MDX rendering now includes `remarkGfm`, `remarkGithubBlockquoteAlert`, `rehypeSlug`, `rehypeAutolinkHeadings`, and `rehypePrism` - matching the full Markdown pipeline.
95
+
96
+ ### Changed
97
+
98
+ - `customRenderer` in `markdown.ts` is now exported so it can be shared between the Markdown and MDX pipelines.
99
+ - `ArticleContent` passes `/articles/{article.slug}` as `basePath` to `renderMdxSource`, enabling correct image URL resolution for both flat and nested article slugs.
100
+ - `renderMdxSource` accepts an optional `basePath` parameter. When provided, a custom `img` component is injected into the MDX component tree to resolve relative image paths.
101
+
102
+ ## [0.6.0] - 2026-05-21
103
+
104
+ ### Changed
105
+
106
+ - `getAvailableArticleSlugs()` now discovers article directories recursively under `public/articles`, so nested articles such as `public/articles/game-system/article-name/article.mdx` produce the slug `game-system/article-name`.
107
+
108
+ ## [0.5.1] - 2026-05-20
109
+
110
+ ### Added
111
+
112
+ - `ArticleTOC` is now exported from `@fullstackdatasolutions/articles/server`, so server route examples can import the server component without pulling from the client entry point.
113
+
114
+ ### Changed
115
+
116
+ - README route examples now use the actual article detail wiring with `getArticleMetadata`, `ArticleContent`, `ArticleDetailHero`, `ArticleSEO`, social sharing, comments, navigation, and scroll-to-top instead of referencing a nonexistent `ArticlePage` export.
117
+ - README category route examples now import `CategoryArticlesPage` from the main package entry and fetch category articles with `getArticlesByCategory`.
118
+ - README frontmatter reference now documents `lastmod`, `draft`, `faq`, `howTo`, `canonicalUrl`, `articleType`, `series`, MDX support, image resolution, generated reading time, and generated table of contents.
119
+ - README server utility examples now include all exported helpers, including static param generators, markdown helpers, `sanitizeImagePath`, `ArticleContent`, and `ArticleTOC`.
120
+
121
+ ### Fixed
122
+
123
+ - README comments setup now includes the required `app/api/articles/comments-store.ts` helper and correctly documents file-backed `comments.json` storage instead of PostgreSQL/Prisma storage.
124
+ - README `ArticleTOC` guidance now imports from `@fullstackdatasolutions/articles/server`, matching the server-only usage guidance.
125
+
126
+ ## [0.5.0] - 2026-05-19
127
+
128
+ ### Added
129
+
130
+ - `ArticleTOC` component - server component (no `'use client'`) that renders `article.toc[]` as an inline nav block above article content. Indentation: h2=0rem, h3=1rem, h4=2rem (based on `item.depth - 2`). Returns `null` when toc is empty. Controlled by `siteConfig.showToc` (gate: `showToc !== false && article.toc?.length > 0`). Exported from index.ts.
131
+ - `ScrollToTop` component - client component (`'use client'`) that renders a fixed-position floating button (bottom-right corner) appearing when user scrolls past 300px. Smooth-scrolls back to top on click. No props. Exported from index.ts.
132
+ - `showToc?: boolean` field on `ArticlesConfig` - optional, defaults to `true` when omitted. Set to `false` to hide the table of contents on all article detail pages.
133
+ - `description?: string` field on `ArticlesConfig` - optional. Short description used as the RSS feed channel description. Falls back to `siteName` if omitted.
134
+ - RSS feed route reference implementation - copy `app/articles/feed.xml/route.ts` from the reference app into consuming apps to enable an RSS 2.0 feed at `/articles/feed.xml`. Uses `force-static` for build-time generation. Uses `getAllArticles` from `@fullstackdatasolutions/articles/server`. Uses `siteConfig.description` for channel description field.
135
+
136
+ ### Changed
137
+
138
+ - `generateArticlesIndexMetadata` now includes `alternates.types['application/rss+xml']` pointing to `${siteUrl}/articles/feed.xml`, automatically adding `<link rel="alternate" type="application/rss+xml">` to the articles index page head.
139
+
140
+ ## [0.4.3] - 2026-05-18
141
+
142
+ ### Added
143
+
144
+ - `generateArticlesIndexMetadata(config: ArticlesConfig): Metadata` - generates full Next.js metadata for the articles index page (`/articles`). Returns title, description, OpenGraph (`type: 'website'`), Twitter Card, canonical URL, and robots directives. Description falls back to `config.hero?.description` when set. Export from `@fullstackdatasolutions/articles/server`.
145
+
146
+ ## [0.4.2] - 2026-05-18
147
+
148
+ ### Changed
149
+
150
+ - `getArticleSitemapEntries` now accepts `string | ArticlesConfig`. Pass your `ArticlesConfig` directly instead of extracting `config.siteUrl` manually. Passing a plain URL string still works (backwards compatible).
151
+
152
+ ## [0.4.1] - 2026-05-18
153
+
154
+ ### Fixed
155
+
156
+ - `CategoryArticlesPage` hero section now uses inline styles for critical layout (`position`, `height`, `overflow`, `z-index`, overlay background). Previously relied on Tailwind classes (`relative h-72 md:h-96`, `absolute inset-0`, `bg-black/60`, `relative z-10`) which have no effect on consuming apps that do not configure Tailwind to scan the package source. Follows the same fix applied to `ArticleCategoryGrid` images in v0.2.1.
157
+ - `ArticleDetailHero` now defaults `categoryBasePath` to `'/articles/category'`, so category tags render as links out of the box. Pass `categoryBasePath=""` to suppress links. Previously omitting the prop produced plain `<span>` elements with no navigation.
158
+ - `ArticleDetailHero` `<Image>` now includes `style={{ objectFit: 'cover' }}` in addition to `className="object-cover"`, ensuring the image fills the hero container correctly on consuming apps where Tailwind may not process the package source.
159
+
160
+ ## [0.4.0] - 2026-05-18
161
+
162
+ ### Added
163
+
164
+ - `ArticleSocialShare` component: social sharing buttons for LinkedIn, Facebook, Twitter, Reddit, WhatsApp, Telegram, Email, and Copy Link. Optional `shareMessage` prop renders a footer paragraph below the buttons. Exported from the main package entry point.
165
+ - `ArticleNavigation` component: previous/next article navigation links. Accepts `previous`, `next` (each `{ slug, title } | null`), and `basePath` props. Returns `null` when both are absent. Titles longer than 60 characters are truncated. Exported from the main package entry point.
166
+
167
+ ### Changed
168
+
169
+ - `ArticleDetailHero` now accepts an optional `showDate?: boolean` prop (default `false`). The article date is hidden by default; pass `showDate={true}` to render it.
170
+
171
+ ## [0.3.0] - 2026-05-14
172
+
173
+ ### Added
174
+
175
+ - `ArticleDetailHero` component: displays the article's featured image behind the title, categories, and metadata in the article detail page hero. Exported from the main package entry point. Accepts `article` and optional `categoryBasePath` props.
176
+
177
+ ### Changed
178
+
179
+ - ArticleDetailHero now displays at most 4 category tags in the article hero. Articles with more than 4 categories show only the first 4.
180
+
181
+ ### Dependencies
182
+
183
+ - `lucide-react` upgraded from `^0.454.0` to `^1.16.0`
184
+ - `rehype-highlight` upgraded from `^7.0.1` to `^7.0.2`
185
+ - `rehype-prism-plus` upgraded from `^2.0.0` to `^2.0.2`
186
+ - `remark-gfm` upgraded from `^4.0.0` to `^4.0.1`
187
+ - `unist-util-visit` upgraded from `^5.0.0` to `^5.1.0`
188
+
189
+ ## [0.2.2] - 2026-05-14
190
+
191
+ ### Changed
192
+
193
+ - Category grid now uses the same responsive layout as Latest Articles: 1 column on mobile, 2 columns at md, 3 columns at lg. Removed conflicting inline `gridTemplateColumns` style that was overriding Tailwind responsive classes.
194
+
195
+ ## [0.2.1] - 2026-05-14
196
+
197
+ ### Added
198
+
199
+ - `keywords` field added to `package.json` for npm discoverability
200
+ - Blog link to [fullstackdatasolutions.com](https://fullstackdatasolutions.com) added to README
201
+
202
+ ### Fixed
203
+
204
+ - Category grid now renders single column on mobile (was 2 columns). Changed `grid-cols-2` to `grid-cols-1`; desktop 4-column layout is unchanged.
205
+ - Category images now render correctly on all consuming apps regardless of whether `@source` is configured in the app's Tailwind CSS. The image container's `position: relative` and `height` are now set via inline styles instead of Tailwind classes (`relative h-52`), which were only generated when the consuming app scanned the package source.
206
+
207
+ No migration needed - both fixes are internal and backwards-compatible.
208
+
209
+ ## [0.2.0] - 2026-05-13
210
+
211
+ ### Added
212
+
213
+ - `HeroConfig` interface with optional `title` and `description` fields
214
+ - `hero` field on `ArticlesConfig` (type `HeroConfig`, fully optional)
215
+ - `ArticlesHero` now accepts `title` and `description` props; built-in strings remain as defaults
216
+
217
+ ### Changed
218
+
219
+ - `renderSection` internal function signature extended with a `config` parameter to forward hero config
220
+ - `frontend/config/articles.ts` (reference app) now explicitly sets `hero.title` and `hero.description` matching the previous hardcoded values
221
+
222
+ ### Migration
223
+
224
+ No breaking changes. Existing `ArticlesConfig` objects without a `hero` field continue to render the original "Vox Populus Insights" heading and description unchanged.
225
+
226
+ To customize the hero for your app, add:
227
+
228
+ ```ts
229
+ hero: {
230
+ title: 'Your App Title',
231
+ description: 'Your custom description.',
232
+ }
233
+ ```
234
+
235
+ ## [0.1.0] - initial release
236
+
237
+ - Initial public release with articles listing, article detail, category pages, comments system, SEO utilities, and theming support.