@riebeckite/plugin-recent-posts 0.0.13 → 0.0.15
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 +2 -2
- package/README_ja.md +2 -1
- package/dist/components/recent-posts.js +2 -2
- package/dist/index.js +3 -4
- package/dist/src/recent-posts.server.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ return <Article afterContent={<RecentPosts posts={recentPosts} />} />;
|
|
|
58
58
|
`RecentPosts({ posts })` renders a
|
|
59
59
|
`<section class="recent-posts rr-recent-posts">` with an eyebrow label and an
|
|
60
60
|
ordered list. Each item links to the post and shows its date formatted for the
|
|
61
|
-
`
|
|
61
|
+
`en-US` locale. The `rr-recent-posts` root hook is the stable class themes may
|
|
62
62
|
target.
|
|
63
63
|
|
|
64
64
|
## Options
|
|
@@ -77,4 +77,4 @@ target.
|
|
|
77
77
|
|
|
78
78
|
## See also
|
|
79
79
|
|
|
80
|
-
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
|
80
|
+
- [Plugin guide](../../../docs/en/docs/reference/plugin-api.md)
|
package/README_ja.md
CHANGED
|
@@ -10,7 +10,7 @@ function RecentPosts(props) {
|
|
|
10
10
|
children: [
|
|
11
11
|
/* @__PURE__ */ jsxs("div", { class: "recent-posts__header", children: [
|
|
12
12
|
/* @__PURE__ */ jsx("p", { class: "recent-posts__eyebrow", children: "RECENT POSTS" }),
|
|
13
|
-
/* @__PURE__ */ jsx("h2", { class: "recent-posts__title", id: "recent-posts-title", children: "
|
|
13
|
+
/* @__PURE__ */ jsx("h2", { class: "recent-posts__title", id: "recent-posts-title", children: "Recent Posts" })
|
|
14
14
|
] }),
|
|
15
15
|
/* @__PURE__ */ jsx("ol", { class: "recent-posts__list", children: props.posts.map((post) => {
|
|
16
16
|
const formattedDate = formatPostedDate(post.postedAt);
|
|
@@ -33,7 +33,7 @@ function RecentPosts(props) {
|
|
|
33
33
|
}
|
|
34
34
|
function formatPostedDate(date) {
|
|
35
35
|
const isoDate = date.toISOString();
|
|
36
|
-
const displayDate = new Intl.DateTimeFormat("
|
|
36
|
+
const displayDate = new Intl.DateTimeFormat("en-US", {
|
|
37
37
|
year: "numeric",
|
|
38
38
|
month: "2-digit",
|
|
39
39
|
day: "2-digit"
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ function RecentPosts(props) {
|
|
|
13
13
|
children: [
|
|
14
14
|
/* @__PURE__ */ jsxs("div", { class: "recent-posts__header", children: [
|
|
15
15
|
/* @__PURE__ */ jsx("p", { class: "recent-posts__eyebrow", children: "RECENT POSTS" }),
|
|
16
|
-
/* @__PURE__ */ jsx("h2", { class: "recent-posts__title", id: "recent-posts-title", children: "
|
|
16
|
+
/* @__PURE__ */ jsx("h2", { class: "recent-posts__title", id: "recent-posts-title", children: "Recent Posts" })
|
|
17
17
|
] }),
|
|
18
18
|
/* @__PURE__ */ jsx("ol", { class: "recent-posts__list", children: props.posts.map((post) => {
|
|
19
19
|
const formattedDate = formatPostedDate(post.postedAt);
|
|
@@ -36,7 +36,7 @@ function RecentPosts(props) {
|
|
|
36
36
|
}
|
|
37
37
|
function formatPostedDate(date) {
|
|
38
38
|
const isoDate = date.toISOString();
|
|
39
|
-
const displayDate = new Intl.DateTimeFormat("
|
|
39
|
+
const displayDate = new Intl.DateTimeFormat("en-US", {
|
|
40
40
|
year: "numeric",
|
|
41
41
|
month: "2-digit",
|
|
42
42
|
day: "2-digit"
|
|
@@ -49,13 +49,11 @@ function formatPostedDate(date) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// src/recent-posts.server.ts
|
|
52
|
-
import { isPublished } from "@riebeckite/core";
|
|
53
52
|
async function getRecentPosts(args) {
|
|
54
53
|
const limit = args.limit ?? 5;
|
|
55
54
|
const recentPosts = await Promise.all(
|
|
56
55
|
args.posts.filter((post) => post.slug !== "index").map(async (post) => {
|
|
57
56
|
const processed = await args.getProcessedContent(post.slug);
|
|
58
|
-
if (!isPublished(args.config, processed.frontmatter)) return null;
|
|
59
57
|
const postedAt = parseFrontmatterDate(
|
|
60
58
|
processed.frontmatter.date ?? processed.frontmatter.created
|
|
61
59
|
);
|
|
@@ -82,6 +80,7 @@ function parseFrontmatterDate(value) {
|
|
|
82
80
|
function recentPostsPlugin() {
|
|
83
81
|
return definePlugin({
|
|
84
82
|
name: "recent-posts",
|
|
83
|
+
outputDependencies: [{ type: "global" }],
|
|
85
84
|
assets: [
|
|
86
85
|
{
|
|
87
86
|
pluginName: "recent-posts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-recent-posts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
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.
|
|
25
|
+
"@riebeckite/core": "0.0.15"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsx": "^4.22.4"
|