@riebeckite/plugin-recent-posts 0.0.11 → 0.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.
Files changed (3) hide show
  1. package/README.md +80 -80
  2. package/README_ja.md +42 -42
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,80 +1,80 @@
1
- # @riebeckite/plugin-recent-posts
2
-
3
- Recent posts list rendering: shows the latest published notes sorted by
4
- frontmatter date.
5
-
6
- [日本語](./README_ja.md)
7
-
8
- ## Overview
9
-
10
- `recentPosts()` provides a `RecentPosts` component that renders an ordered list
11
- of recently posted articles. `getRecentPosts()` filters unpublished notes,
12
- derives a date from the frontmatter (`date` falling back to `created`), sorts
13
- newest first, and truncates to `limit` items. Notes without a parseable date
14
- are dropped.
15
-
16
- With no posts, the component renders nothing.
17
-
18
- ## Usage
19
-
20
- ```ts
21
- import { defineConfig } from "@riebeckite/core";
22
- import { recentPostsPlugin } from "@riebeckite/plugin-recent-posts";
23
-
24
- export default defineConfig({
25
- // ...
26
- plugins: [recentPostsPlugin()],
27
- });
28
- ```
29
-
30
- `recentPostsPlugin()` registers the plugin in the plugin list and bundles
31
- `style.css` into the app stylesheet.
32
-
33
- ### Render the component
34
-
35
- ```tsx
36
- import RecentPosts, { getRecentPosts } from "@riebeckite/plugin-recent-posts";
37
- import { config } from "../config";
38
- import { content } from "../content";
39
- import { getArticleTitle } from "../lib/article-title";
40
-
41
- const posts = await content.getAllPosts();
42
- const recentPosts = await getRecentPosts({
43
- posts,
44
- config,
45
- getProcessedContent: (slug) => content.getProcessedContent(slug),
46
- resolveTitle: getArticleTitle,
47
- limit: 5,
48
- });
49
-
50
- // ...in your route
51
- return <Article afterContent={<RecentPosts posts={recentPosts} />} />;
52
- ```
53
-
54
- `getRecentPosts()` filters out the `index` note before collecting posts.
55
-
56
- ## Component
57
-
58
- `RecentPosts({ posts })` renders a
59
- `<section class="recent-posts rr-recent-posts">` with an eyebrow label and an
60
- ordered list. Each item links to the post and shows its date formatted for the
61
- `ja-JP` locale. The `rr-recent-posts` root hook is the stable class themes may
62
- target.
63
-
64
- ## Options
65
-
66
- | Option | Type | Default | Description |
67
- | ------ | ---- | ------- | ----------- |
68
- | `limit` | `number` | `5` | Maximum number of posts to return |
69
-
70
- ## Exports
71
-
72
- - `recentPostsPlugin()` — plugin factory
73
- - `RecentPosts` — list component (default export of `components/recent-posts.tsx`)
74
- - `getRecentPosts({ posts, config, getProcessedContent, resolveTitle, limit? })`
75
- — collects the latest published posts
76
- - Type: `RecentPost` (`{ slug, permalink, title, postedAt }`)
77
-
78
- ## See also
79
-
80
- - [Plugin guide](../../../docs/en/plugin-system.md)
1
+ # @riebeckite/plugin-recent-posts
2
+
3
+ Recent posts list rendering: shows the latest published notes sorted by
4
+ frontmatter date.
5
+
6
+ [日本語](./README_ja.md)
7
+
8
+ ## Overview
9
+
10
+ `recentPosts()` provides a `RecentPosts` component that renders an ordered list
11
+ of recently posted articles. `getRecentPosts()` filters unpublished notes,
12
+ derives a date from the frontmatter (`date` falling back to `created`), sorts
13
+ newest first, and truncates to `limit` items. Notes without a parseable date
14
+ are dropped.
15
+
16
+ With no posts, the component renders nothing.
17
+
18
+ ## Usage
19
+
20
+ ```ts
21
+ import { defineConfig } from "@riebeckite/core";
22
+ import { recentPostsPlugin } from "@riebeckite/plugin-recent-posts";
23
+
24
+ export default defineConfig({
25
+ // ...
26
+ plugins: [recentPostsPlugin()],
27
+ });
28
+ ```
29
+
30
+ `recentPostsPlugin()` registers the plugin in the plugin list and bundles
31
+ `style.css` into the app stylesheet.
32
+
33
+ ### Render the component
34
+
35
+ ```tsx
36
+ import RecentPosts, { getRecentPosts } from "@riebeckite/plugin-recent-posts";
37
+ import { config } from "../config";
38
+ import { content } from "../content";
39
+ import { getArticleTitle } from "../lib/article-title";
40
+
41
+ const posts = await content.getAllPosts();
42
+ const recentPosts = await getRecentPosts({
43
+ posts,
44
+ config,
45
+ getProcessedContent: (slug) => content.getProcessedContent(slug),
46
+ resolveTitle: getArticleTitle,
47
+ limit: 5,
48
+ });
49
+
50
+ // ...in your route
51
+ return <Article afterContent={<RecentPosts posts={recentPosts} />} />;
52
+ ```
53
+
54
+ `getRecentPosts()` filters out the `index` note before collecting posts.
55
+
56
+ ## Component
57
+
58
+ `RecentPosts({ posts })` renders a
59
+ `<section class="recent-posts rr-recent-posts">` with an eyebrow label and an
60
+ ordered list. Each item links to the post and shows its date formatted for the
61
+ `ja-JP` locale. The `rr-recent-posts` root hook is the stable class themes may
62
+ target.
63
+
64
+ ## Options
65
+
66
+ | Option | Type | Default | Description |
67
+ | ------ | ---- | ------- | ----------- |
68
+ | `limit` | `number` | `5` | Maximum number of posts to return |
69
+
70
+ ## Exports
71
+
72
+ - `recentPostsPlugin()` — plugin factory
73
+ - `RecentPosts` — list component (default export of `components/recent-posts.tsx`)
74
+ - `getRecentPosts({ posts, config, getProcessedContent, resolveTitle, limit? })`
75
+ — collects the latest published posts
76
+ - Type: `RecentPost` (`{ slug, permalink, title, postedAt }`)
77
+
78
+ ## See also
79
+
80
+ - [Plugin guide](../../../docs/en/reference/plugin-api.md)
package/README_ja.md CHANGED
@@ -1,42 +1,42 @@
1
- # @riebeckite/plugin-recent-posts
2
-
3
- 公開済みノートを日付順に並べ、最新の記事一覧として表示するプラグインです。
4
-
5
- [English](./README.md)
6
-
7
- ## できること
8
-
9
- `getRecentPosts()` は非公開ノートと `index` ノートを除き、`frontmatter.date`、なければ `created` を基準に新しい順へ並べます。日付を解釈できないノートは一覧から外れます。`RecentPosts` は結果が空なら何も描画しません。
10
-
11
- ## 設定と配置
12
-
13
- ```ts
14
- import { defineConfig } from "@riebeckite/core";
15
- import { recentPostsPlugin } from "@riebeckite/plugin-recent-posts";
16
-
17
- export default defineConfig({ plugins: [recentPostsPlugin()] });
18
- ```
19
-
20
- 一覧を置く場所はアプリ側で決めます。
21
-
22
- ```tsx
23
- import RecentPosts, { getRecentPosts } from "@riebeckite/plugin-recent-posts";
24
-
25
- const posts = await getRecentPosts({ posts: await content.getAllPosts(), config, getProcessedContent: content.getProcessedContent, resolveTitle, limit: 5 });
26
- return <Article afterContent={<RecentPosts posts={posts} />} />;
27
- ```
28
-
29
- | オプション | 既定値 | 内容 |
30
- | --- | --- | --- |
31
- | `limit` | `5` | 返す記事数の上限 |
32
-
33
- ## 公開 API
34
-
35
- - `recentPostsPlugin()` — プラグインファクトリ
36
- - `RecentPosts` — 最新記事一覧コンポーネント
37
- - `getRecentPosts({ posts, config, getProcessedContent, resolveTitle, limit? })`
38
- - `RecentPost` — `{ slug, permalink, title, postedAt }` の型
39
-
40
- ## 関連資料
41
-
42
- - [プラグインシステム](../../../docs/ja/plugin-system.md)
1
+ # @riebeckite/plugin-recent-posts
2
+
3
+ 公開済みノートを日付順に並べ、最新の記事一覧として表示するプラグインです。
4
+
5
+ [English](./README.md)
6
+
7
+ ## できること
8
+
9
+ `getRecentPosts()` は非公開ノートと `index` ノートを除き、`frontmatter.date`、なければ `created` を基準に新しい順へ並べます。日付を解釈できないノートは一覧から外れます。`RecentPosts` は結果が空なら何も描画しません。
10
+
11
+ ## 設定と配置
12
+
13
+ ```ts
14
+ import { defineConfig } from "@riebeckite/core";
15
+ import { recentPostsPlugin } from "@riebeckite/plugin-recent-posts";
16
+
17
+ export default defineConfig({ plugins: [recentPostsPlugin()] });
18
+ ```
19
+
20
+ 一覧を置く場所はアプリ側で決めます。
21
+
22
+ ```tsx
23
+ import RecentPosts, { getRecentPosts } from "@riebeckite/plugin-recent-posts";
24
+
25
+ const posts = await getRecentPosts({ posts: await content.getAllPosts(), config, getProcessedContent: content.getProcessedContent, resolveTitle, limit: 5 });
26
+ return <Article afterContent={<RecentPosts posts={posts} />} />;
27
+ ```
28
+
29
+ | オプション | 既定値 | 内容 |
30
+ | --- | --- | --- |
31
+ | `limit` | `5` | 返す記事数の上限 |
32
+
33
+ ## 公開 API
34
+
35
+ - `recentPostsPlugin()` — プラグインファクトリ
36
+ - `RecentPosts` — 最新記事一覧コンポーネント
37
+ - `getRecentPosts({ posts, config, getProcessedContent, resolveTitle, limit? })`
38
+ - `RecentPost` — `{ slug, permalink, title, postedAt }` の型
39
+
40
+ ## 関連資料
41
+
42
+ - [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-recent-posts",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "hono": "^4.12.25",
25
- "@riebeckite/core": "0.0.11"
25
+ "@riebeckite/core": "0.0.13"
26
26
  },
27
27
  "devDependencies": {
28
28
  "tsx": "^4.22.4"