@riebeckite/plugin-backlinks 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.
- package/README.md +73 -73
- package/README_ja.md +45 -45
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
# @riebeckite/plugin-backlinks
|
|
2
|
-
|
|
3
|
-
Backlink list rendering for articles: shows which published notes link to the
|
|
4
|
-
current note.
|
|
5
|
-
|
|
6
|
-
[日本語](./README_ja.md)
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
`backlinks()` provides a `Backlinks` component that renders a footer list of
|
|
11
|
-
incoming links. `getPublishedBacklinks()` resolves the incoming links of a
|
|
12
|
-
note from the content manifest, keeps only notes whose `frontmatter` passes
|
|
13
|
-
`isPublished`, and returns them sorted in manifest order.
|
|
14
|
-
|
|
15
|
-
Without incoming links (or when none of them are published), the component
|
|
16
|
-
renders nothing.
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
import { defineConfig } from "@riebeckite/core";
|
|
22
|
-
import { backlinksPlugin } from "@riebeckite/plugin-backlinks";
|
|
23
|
-
|
|
24
|
-
export default defineConfig({
|
|
25
|
-
// ...
|
|
26
|
-
plugins: [backlinksPlugin()],
|
|
27
|
-
});
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
`backlinksPlugin()` 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 Backlinks, { getPublishedBacklinks } from "@riebeckite/plugin-backlinks";
|
|
37
|
-
import { config } from "../config";
|
|
38
|
-
import { content } from "../content";
|
|
39
|
-
import { getArticleTitle } from "../lib/article-title";
|
|
40
|
-
|
|
41
|
-
const manifest = await content.getManifest();
|
|
42
|
-
const backlinks = getPublishedBacklinks({
|
|
43
|
-
manifest,
|
|
44
|
-
config,
|
|
45
|
-
slug,
|
|
46
|
-
resolveTitle: getArticleTitle,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// ...in your route
|
|
50
|
-
return (
|
|
51
|
-
<Article
|
|
52
|
-
footerContent={<Backlinks backlinks={backlinks} />}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Component
|
|
58
|
-
|
|
59
|
-
`Backlinks({ backlinks })` renders a `<footer class="article-backlinks">` with
|
|
60
|
-
an eyebrow label and a list of links to each backlink's resolved `permalink`.
|
|
61
|
-
|
|
62
|
-
## Exports
|
|
63
|
-
|
|
64
|
-
- `backlinksPlugin()` — plugin factory
|
|
65
|
-
- `Backlinks` — list component (default export of `components/backlinks.tsx`)
|
|
66
|
-
- `getPublishedBacklinks({ manifest, config, slug, resolveTitle })` — resolves
|
|
67
|
-
published backlinks for a slug
|
|
68
|
-
- Type: `ArticleBacklink` (`{ slug, permalink, title }`)
|
|
69
|
-
|
|
70
|
-
## See also
|
|
71
|
-
|
|
72
|
-
- [Plugin guide](../../../docs/en/plugin-
|
|
73
|
-
- [`@riebeckite/plugin-local-graph`](../local-graph/README.md)
|
|
1
|
+
# @riebeckite/plugin-backlinks
|
|
2
|
+
|
|
3
|
+
Backlink list rendering for articles: shows which published notes link to the
|
|
4
|
+
current note.
|
|
5
|
+
|
|
6
|
+
[日本語](./README_ja.md)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
`backlinks()` provides a `Backlinks` component that renders a footer list of
|
|
11
|
+
incoming links. `getPublishedBacklinks()` resolves the incoming links of a
|
|
12
|
+
note from the content manifest, keeps only notes whose `frontmatter` passes
|
|
13
|
+
`isPublished`, and returns them sorted in manifest order.
|
|
14
|
+
|
|
15
|
+
Without incoming links (or when none of them are published), the component
|
|
16
|
+
renders nothing.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { defineConfig } from "@riebeckite/core";
|
|
22
|
+
import { backlinksPlugin } from "@riebeckite/plugin-backlinks";
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
// ...
|
|
26
|
+
plugins: [backlinksPlugin()],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`backlinksPlugin()` 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 Backlinks, { getPublishedBacklinks } from "@riebeckite/plugin-backlinks";
|
|
37
|
+
import { config } from "../config";
|
|
38
|
+
import { content } from "../content";
|
|
39
|
+
import { getArticleTitle } from "../lib/article-title";
|
|
40
|
+
|
|
41
|
+
const manifest = await content.getManifest();
|
|
42
|
+
const backlinks = getPublishedBacklinks({
|
|
43
|
+
manifest,
|
|
44
|
+
config,
|
|
45
|
+
slug,
|
|
46
|
+
resolveTitle: getArticleTitle,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// ...in your route
|
|
50
|
+
return (
|
|
51
|
+
<Article
|
|
52
|
+
footerContent={<Backlinks backlinks={backlinks} />}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Component
|
|
58
|
+
|
|
59
|
+
`Backlinks({ backlinks })` renders a `<footer class="article-backlinks">` with
|
|
60
|
+
an eyebrow label and a list of links to each backlink's resolved `permalink`.
|
|
61
|
+
|
|
62
|
+
## Exports
|
|
63
|
+
|
|
64
|
+
- `backlinksPlugin()` — plugin factory
|
|
65
|
+
- `Backlinks` — list component (default export of `components/backlinks.tsx`)
|
|
66
|
+
- `getPublishedBacklinks({ manifest, config, slug, resolveTitle })` — resolves
|
|
67
|
+
published backlinks for a slug
|
|
68
|
+
- Type: `ArticleBacklink` (`{ slug, permalink, title }`)
|
|
69
|
+
|
|
70
|
+
## See also
|
|
71
|
+
|
|
72
|
+
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
|
73
|
+
- [`@riebeckite/plugin-local-graph`](../local-graph/README.md)
|
|
74
74
|
- [`@riebeckite/plugin-garden-explorer`](../garden-explorer/README.md)
|
package/README_ja.md
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
# @riebeckite/plugin-backlinks
|
|
2
|
-
|
|
3
|
-
現在の記事を参照している公開済みノートを、記事末尾に表示するためのプラグインです。
|
|
4
|
-
|
|
5
|
-
[English](./README.md)
|
|
6
|
-
|
|
7
|
-
## できること
|
|
8
|
-
|
|
9
|
-
`getPublishedBacklinks()` はコンテンツマニフェストから被リンクを集め、`isPublished` を通るノートだけをマニフェスト順で返します。`Backlinks` コンポーネントはその結果をフッターのリンク一覧として描画します。表示対象がなければ何も出力しません。
|
|
10
|
-
|
|
11
|
-
## 設定と配置
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { defineConfig } from "@riebeckite/core";
|
|
15
|
-
import { backlinksPlugin } from "@riebeckite/plugin-backlinks";
|
|
16
|
-
|
|
17
|
-
export default defineConfig({
|
|
18
|
-
// ...
|
|
19
|
-
plugins: [backlinksPlugin()],
|
|
20
|
-
});
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
プラグイン登録後も、表示位置はアプリ側で決めます。記事ルートなどでマニフェストを取得し、現在の `slug` に対する被リンクを渡してください。
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import Backlinks, { getPublishedBacklinks } from "@riebeckite/plugin-backlinks";
|
|
27
|
-
|
|
28
|
-
const manifest = await content.getManifest();
|
|
29
|
-
const items = getPublishedBacklinks({ manifest, config, slug, resolveTitle });
|
|
30
|
-
|
|
31
|
-
return <Article footerContent={<Backlinks backlinks={items} />} />;
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## 公開 API
|
|
35
|
-
|
|
36
|
-
- `backlinksPlugin()` — プラグインファクトリ
|
|
37
|
-
- `Backlinks` — 被リンク一覧コンポーネント
|
|
38
|
-
- `getPublishedBacklinks({ manifest, config, slug, resolveTitle })` — 公開済みの被リンクを解決する関数
|
|
39
|
-
- `ArticleBacklink` — `{ slug, permalink, title }` の型。`permalink` は解決済みの canonical URL
|
|
40
|
-
|
|
41
|
-
## 関連資料
|
|
42
|
-
|
|
43
|
-
- [プラグインシステム](../../../docs/ja/plugin-
|
|
44
|
-
- [`@riebeckite/plugin-local-graph`](../local-graph/README_ja.md)
|
|
45
|
-
- [`@riebeckite/plugin-garden-explorer`](../garden-explorer/README_ja.md)
|
|
1
|
+
# @riebeckite/plugin-backlinks
|
|
2
|
+
|
|
3
|
+
現在の記事を参照している公開済みノートを、記事末尾に表示するためのプラグインです。
|
|
4
|
+
|
|
5
|
+
[English](./README.md)
|
|
6
|
+
|
|
7
|
+
## できること
|
|
8
|
+
|
|
9
|
+
`getPublishedBacklinks()` はコンテンツマニフェストから被リンクを集め、`isPublished` を通るノートだけをマニフェスト順で返します。`Backlinks` コンポーネントはその結果をフッターのリンク一覧として描画します。表示対象がなければ何も出力しません。
|
|
10
|
+
|
|
11
|
+
## 設定と配置
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { defineConfig } from "@riebeckite/core";
|
|
15
|
+
import { backlinksPlugin } from "@riebeckite/plugin-backlinks";
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
// ...
|
|
19
|
+
plugins: [backlinksPlugin()],
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
プラグイン登録後も、表示位置はアプリ側で決めます。記事ルートなどでマニフェストを取得し、現在の `slug` に対する被リンクを渡してください。
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import Backlinks, { getPublishedBacklinks } from "@riebeckite/plugin-backlinks";
|
|
27
|
+
|
|
28
|
+
const manifest = await content.getManifest();
|
|
29
|
+
const items = getPublishedBacklinks({ manifest, config, slug, resolveTitle });
|
|
30
|
+
|
|
31
|
+
return <Article footerContent={<Backlinks backlinks={items} />} />;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 公開 API
|
|
35
|
+
|
|
36
|
+
- `backlinksPlugin()` — プラグインファクトリ
|
|
37
|
+
- `Backlinks` — 被リンク一覧コンポーネント
|
|
38
|
+
- `getPublishedBacklinks({ manifest, config, slug, resolveTitle })` — 公開済みの被リンクを解決する関数
|
|
39
|
+
- `ArticleBacklink` — `{ slug, permalink, title }` の型。`permalink` は解決済みの canonical URL
|
|
40
|
+
|
|
41
|
+
## 関連資料
|
|
42
|
+
|
|
43
|
+
- [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
|
|
44
|
+
- [`@riebeckite/plugin-local-graph`](../local-graph/README_ja.md)
|
|
45
|
+
- [`@riebeckite/plugin-garden-explorer`](../garden-explorer/README_ja.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-backlinks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"hono": "^4.12.25",
|
|
25
|
-
"@riebeckite/core": "0.0.
|
|
25
|
+
"@riebeckite/core": "0.0.13"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsx": "^4.22.4",
|
|
29
|
-
"@riebeckite/test": "0.0.
|
|
29
|
+
"@riebeckite/test": "0.0.13"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|