@riebeckite/plugin-recent-posts 0.0.20 → 0.0.22

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # @riebeckite/plugin-recent-posts
2
2
 
3
+ <!-- Generated from docs/docs/plugins/recent-posts.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
4
+
3
5
  Recent posts list rendering: shows the latest published notes sorted by
4
6
  frontmatter date.
5
7
 
@@ -7,13 +9,13 @@ frontmatter date.
7
9
 
8
10
  ## Overview
9
11
 
10
- `recentPosts()` provides a `RecentPosts` component that renders an ordered list
11
- of recently posted articles. `getRecentPosts()` reads
12
+ `RecentPosts` renders an ordered list of recently posted articles.
13
+ `getRecentPosts()` reads
12
14
  `manifest.discoverableEntries`, so `unlisted`, `draft`, and scheduled notes are
13
15
  excluded. It derives a date from the frontmatter (`date` falling back to
14
16
  `created`), sorts newest first, and truncates to `limit` items. Notes without a
15
- parseable date are dropped. Whether and where to place the list is the site's
16
- decision.
17
+ parseable date are dropped. Official `starter` and `showcase` sites place the
18
+ list explicitly in their homepage route after the page content.
17
19
 
18
20
  With no posts, the component renders nothing.
19
21
 
@@ -30,21 +32,25 @@ export default defineConfig({
30
32
  ```
31
33
 
32
34
  `recentPostsPlugin()` registers the plugin in the plugin list and bundles
33
- `style.css` into the app stylesheet.
35
+ `style.css` into the app stylesheet; it never renders UI itself. The generated
36
+ `starter` and `showcase` demonstrate the recommended homepage placement.
34
37
 
35
- ### Render the component
38
+ ### Custom placement
36
39
 
37
40
  ```tsx
38
- import RecentPosts, { getRecentPosts } from "@riebeckite/plugin-recent-posts";
39
- import { content } from "../content";
41
+ import { RecentPosts, getRecentPosts } from "@riebeckite/plugin-recent-posts";
42
+ import { content } from "virtual:riebeckite/content";
40
43
 
41
44
  const recentPosts = getRecentPosts({ manifest: await content.getManifest() });
42
45
 
43
- // ...in your route
44
- return <Article afterContent={<RecentPosts posts={recentPosts} />} />;
46
+ // ...in a homepage route or site-owned layout
47
+ return <RecentPosts posts={recentPosts} />;
45
48
  ```
46
49
 
47
50
  `getRecentPosts()` filters out the `index` note before collecting posts.
51
+ To disable the generated homepage list, remove its `RecentPosts` import and
52
+ `afterContent` prop. To reposition it, move that same element to the desired
53
+ existing route or layout slot.
48
54
 
49
55
  ## Component
50
56
 
@@ -71,4 +77,4 @@ target.
71
77
 
72
78
  ## See also
73
79
 
74
- - [Plugin guide](../../../docs/docs/reference/plugin-api.md)
80
+ - [Plugin guide](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.md)
package/README_ja.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # @riebeckite/plugin-recent-posts
2
2
 
3
+ <!-- Generated from docs/docs/plugins/recent-posts.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
4
+
3
5
  公開済みノートを日付順に並べ、最新の記事一覧として表示するプラグインです。
4
6
 
5
7
  [English](./README.md)
6
8
 
7
9
  ## できること
8
10
 
9
- `getRecentPosts()` は `manifest.discoverableEntries` を読み、unlisted・draft・予約公開のノートと `index` ノートを除き、`frontmatter.date`、なければ `created` を基準に新しい順へ並べます。日付を解釈できないノートは一覧から外れます。`RecentPosts` は結果が空なら何も描画しません。一覧を置くかどうか、どこへ置くかは Site 側で決めます。
11
+ `getRecentPosts()` は `manifest.discoverableEntries` を読み、unlisted・draft・予約公開のノートと `index` ノートを除き、`frontmatter.date`、なければ `created` を基準に新しい順へ並べます。日付を解釈できないノートは一覧から外れます。`RecentPosts` は結果が空なら何も描画しません。公式の `starter` と `showcase` は、ホームページ route で一覧を本文の後に明示的に配置します。
10
12
 
11
13
  ## 設定と配置
12
14
 
@@ -17,16 +19,18 @@ import { recentPostsPlugin } from "@riebeckite/plugin-recent-posts";
17
19
  export default defineConfig({ plugins: [recentPostsPlugin()] });
18
20
  ```
19
21
 
20
- 一覧を置く場所はアプリ側で決めます。
22
+ `recentPostsPlugin()` は UI を自動描画しません。生成された `starter` と `showcase` は推奨するホームページ配置を実装しています。独自の配置では、アプリ側で表示位置を決めます。
21
23
 
22
24
  ```tsx
23
- import RecentPosts, { getRecentPosts } from "@riebeckite/plugin-recent-posts";
24
- import { content } from "../content";
25
+ import { RecentPosts, getRecentPosts } from "@riebeckite/plugin-recent-posts";
26
+ import { content } from "virtual:riebeckite/content";
25
27
 
26
28
  const posts = getRecentPosts({ manifest: await content.getManifest() });
27
- return <Article afterContent={<RecentPosts posts={posts} />} />;
29
+ return <RecentPosts posts={posts} />;
28
30
  ```
29
31
 
32
+ 生成されたホームページの一覧を無効にするには、`RecentPosts` の import と `afterContent` prop を削除します。位置を変える場合は、同じ要素を既存の route または layout の目的の slot へ移動します。
33
+
30
34
  | オプション | 既定値 | 内容 |
31
35
  | --- | --- | --- |
32
36
  | `manifest` | 必須 | 候補ノートの取得元(`discoverableEntries`) |
@@ -41,5 +45,4 @@ return <Article afterContent={<RecentPosts posts={posts} />} />;
41
45
 
42
46
  ## 関連資料
43
47
 
44
- - [プラグインシステム](../../../docs/docs/reference/plugin-api.ja.md)
45
-
48
+ - [プラグインシステム](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.ja.md)
@@ -1,6 +1,6 @@
1
1
  import type { RecentPost } from "../src/recent-posts.js";
2
2
  type Props = {
3
- posts: RecentPost[];
3
+ posts?: RecentPost[];
4
4
  };
5
5
  export default function RecentPosts(props: Props): import("hono/jsx/jsx-dev-runtime").JSX.Element;
6
6
  export {};
@@ -1,10 +1,11 @@
1
1
  // components/recent-posts.tsx
2
2
  import { jsx, jsxs } from "hono/jsx/jsx-runtime";
3
3
  function RecentPosts(props) {
4
- if (props.posts.length === 0) return null;
4
+ const posts = props.posts ?? [];
5
+ if (posts.length === 0) return null;
5
6
  return /* @__PURE__ */ jsxs("section", { class: "rr-recent-posts", "aria-labelledby": "recent-posts-title", children: [
6
7
  /* @__PURE__ */ jsx("div", { class: "rr-recent-posts__header", children: /* @__PURE__ */ jsx("h2", { class: "rr-recent-posts__title", id: "recent-posts-title", children: "Recent Posts" }) }),
7
- /* @__PURE__ */ jsx("ol", { class: "rr-recent-posts__list", children: props.posts.map((post) => {
8
+ /* @__PURE__ */ jsx("ol", { class: "rr-recent-posts__list", children: posts.map((post) => {
8
9
  const formattedDate = formatPostedDate(post.postedAt);
9
10
  return /* @__PURE__ */ jsx("li", { class: "rr-recent-posts__item", children: /* @__PURE__ */ jsxs("a", { class: "rr-recent-posts__link", href: post.permalink, children: [
10
11
  /* @__PURE__ */ jsx(
package/dist/index.js CHANGED
@@ -4,10 +4,11 @@ import { definePlugin } from "@riebeckite/core";
4
4
  // components/recent-posts.tsx
5
5
  import { jsx, jsxs } from "hono/jsx/jsx-runtime";
6
6
  function RecentPosts(props) {
7
- if (props.posts.length === 0) return null;
7
+ const posts = props.posts ?? [];
8
+ if (posts.length === 0) return null;
8
9
  return /* @__PURE__ */ jsxs("section", { class: "rr-recent-posts", "aria-labelledby": "recent-posts-title", children: [
9
10
  /* @__PURE__ */ jsx("div", { class: "rr-recent-posts__header", children: /* @__PURE__ */ jsx("h2", { class: "rr-recent-posts__title", id: "recent-posts-title", children: "Recent Posts" }) }),
10
- /* @__PURE__ */ jsx("ol", { class: "rr-recent-posts__list", children: props.posts.map((post) => {
11
+ /* @__PURE__ */ jsx("ol", { class: "rr-recent-posts__list", children: posts.map((post) => {
11
12
  const formattedDate = formatPostedDate(post.postedAt);
12
13
  return /* @__PURE__ */ jsx("li", { class: "rr-recent-posts__item", children: /* @__PURE__ */ jsxs("a", { class: "rr-recent-posts__link", href: post.permalink, children: [
13
14
  /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-recent-posts",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
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.20"
25
+ "@riebeckite/core": "0.0.22"
26
26
  },
27
27
  "devDependencies": {
28
28
  "tsx": "^4.22.4"
package/style.css CHANGED
@@ -1,8 +1,9 @@
1
1
  @layer components {
2
2
  .rr-recent-posts {
3
- margin-top: 4rem;
3
+ margin-top: var(--rb-space-6, 3rem);
4
4
  padding-top: 1.5rem;
5
- border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
5
+ border-top: 1px solid
6
+ var(--rb-color-border, color-mix(in srgb, currentColor 18%, transparent));
6
7
  }
7
8
 
8
9
  .rr-recent-posts__header {
@@ -11,7 +12,8 @@
11
12
 
12
13
  .rr-recent-posts__title {
13
14
  margin: 0;
14
- font-size: clamp(1.5rem, 4vw, 2rem);
15
+ font-size: 1.125rem;
16
+ font-weight: 700;
15
17
  line-height: 1.2;
16
18
  letter-spacing: -0.02em;
17
19
  }