@riebeckite/plugin-related-posts 0.0.1
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/LICENSE +201 -0
- package/README.md +93 -0
- package/README_ja.md +95 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +197 -0
- package/dist/src/options.d.ts +10 -0
- package/dist/src/related.d.ts +31 -0
- package/dist/src/render.d.ts +8 -0
- package/dist/src/types.d.ts +35 -0
- package/package.json +55 -0
- package/style.css +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright Rerurate_514
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @riebeckite/plugin-related-posts
|
|
2
|
+
|
|
3
|
+
Build-time "related notes" navigation. For every published entry, the plugin
|
|
4
|
+
ranks the other entries in the content manifest and appends a related-posts
|
|
5
|
+
section to the rendered HTML. No client-side JavaScript is required.
|
|
6
|
+
|
|
7
|
+
[日本語](./README_ja.md)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
`relatedPosts()` reads the manifest's content graph and scores every other
|
|
12
|
+
published entry against the current one:
|
|
13
|
+
|
|
14
|
+
| Signal | Weight | Meaning |
|
|
15
|
+
| ------ | ------ | ------- |
|
|
16
|
+
| Direct link | 3 | The entry links to the candidate, or the candidate links to the entry |
|
|
17
|
+
| Shared tag | 2 per common tag | The entry and the candidate share a tag |
|
|
18
|
+
| Co-citation | 1 per common target | Both entries link to the same note |
|
|
19
|
+
|
|
20
|
+
Candidates are sorted by score (descending), then by title, then by slug, and
|
|
21
|
+
clamped to `limit`. Entries that score below `minScore` are dropped. When no
|
|
22
|
+
candidate qualifies, the entry's HTML is left untouched.
|
|
23
|
+
|
|
24
|
+
The plugin updates both `entry.html` and the cached `PostContent.html` that the
|
|
25
|
+
content route renders, so the section appears on generated pages and in feeds.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { defineConfig } from "@riebeckite/core";
|
|
31
|
+
import { relatedPosts } from "@riebeckite/plugin-related-posts";
|
|
32
|
+
|
|
33
|
+
export default defineConfig({
|
|
34
|
+
// ...
|
|
35
|
+
plugins: [relatedPosts()],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Options
|
|
40
|
+
|
|
41
|
+
| Option | Type | Default | Description |
|
|
42
|
+
| ------ | ---- | ------- | ----------- |
|
|
43
|
+
| `limit` | `number` | `5` | Maximum number of related entries |
|
|
44
|
+
| `minScore` | `number` | `1` | Minimum score required to be listed |
|
|
45
|
+
| `heading` | `boolean` | `true` | Render the `<h2>` heading |
|
|
46
|
+
| `headingText` | `string` | `"Related"` | Heading text |
|
|
47
|
+
| `className` | `string` | `"rb-related-posts"` | Root CSS class |
|
|
48
|
+
| `useTags` | `boolean` | `true` | Include the shared-tag signal |
|
|
49
|
+
| `useBacklinks` | `boolean` | `true` | Include the direct-link signal |
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
relatedPosts({
|
|
53
|
+
limit: 8,
|
|
54
|
+
minScore: 2,
|
|
55
|
+
headingText: "Related notes",
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Output
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<nav class="rb-related-posts" data-related-posts>
|
|
63
|
+
<h2 class="rb-related-posts__heading">Related</h2>
|
|
64
|
+
<ul>
|
|
65
|
+
<li class="rb-related-posts__item">
|
|
66
|
+
<a class="rb-related-posts__link" href="/notes/example" data-related-score="5">Example Note</a>
|
|
67
|
+
</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</nav>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Style
|
|
73
|
+
|
|
74
|
+
The package ships `style.css`. Register it like any other plugin stylesheet:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import "@riebeckite/plugin-related-posts/style.css";
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Exports
|
|
81
|
+
|
|
82
|
+
- `relatedPosts(options?)` — plugin factory
|
|
83
|
+
- `relatedPostsPlugin` — alias of `relatedPosts`
|
|
84
|
+
- `resolveRelatedPostsOptions(options?)` — apply option defaults
|
|
85
|
+
- `buildRelatedPosts({ manifest, entry, options, config? })` — rank related entries
|
|
86
|
+
- `renderRelatedPosts(entries, options)` — render the navigation HTML
|
|
87
|
+
- Types: `RelatedPostsOptions`, `ResolvedRelatedPostsOptions`, `RelatedPostsEntry`
|
|
88
|
+
|
|
89
|
+
## Limitations
|
|
90
|
+
|
|
91
|
+
- Ranking is fixed at build time. A full rebuild always recomputes correctly.
|
|
92
|
+
- Only tags, direct links, and co-citations are considered. Reading time,
|
|
93
|
+
recency, and folders are intentionally ignored to keep ranking deterministic.
|
package/README_ja.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @riebeckite/plugin-related-posts
|
|
2
|
+
|
|
3
|
+
ビルド時に「関連ノート」ナビゲーションを生成するプラグインです。公開対象の
|
|
4
|
+
各エントリについて、コンテンツマニフェスト上の他のエントリをスコア順に並べ、
|
|
5
|
+
関連ノートのセクションを HTML に追記します。クライアント側 JavaScript は
|
|
6
|
+
不要です。
|
|
7
|
+
|
|
8
|
+
[English](./README.md)
|
|
9
|
+
|
|
10
|
+
## 仕組み
|
|
11
|
+
|
|
12
|
+
`relatedPosts()` はマニフェストのコンテンツグラフを読み、現在のエントリと
|
|
13
|
+
他の公開エントリを次のシグナルで採点します。
|
|
14
|
+
|
|
15
|
+
| シグナル | 重み | 意味 |
|
|
16
|
+
| -------- | ---- | ---- |
|
|
17
|
+
| 直接リンク | 3 | 現在のエントリが候補へ、または候補が現在のエントリへリンクしている |
|
|
18
|
+
| タグの共有 | 共通タグ1件につき2 | 現在のエントリと候補が同じタグを持つ |
|
|
19
|
+
| 共引用 | 共通リンク先1件につき1 | 両方のエントリが同じノートへリンクしている |
|
|
20
|
+
|
|
21
|
+
候補はスコアの降順、同点ならタイトル、さらに同点ならスラッグの順に並べ、
|
|
22
|
+
`limit` 件に絞ります。`minScore` 未満の候補は除外します。条件を満たす候補が
|
|
23
|
+
1件もない場合、そのエントリの HTML は変更しません。
|
|
24
|
+
|
|
25
|
+
`entry.html` と、コンテンツルートが描画するキャッシュ済みの
|
|
26
|
+
`PostContent.html` の両方を更新するため、生成ページとフィードの両方に
|
|
27
|
+
セクションが反映されます。
|
|
28
|
+
|
|
29
|
+
## 使い方
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { defineConfig } from "@riebeckite/core";
|
|
33
|
+
import { relatedPosts } from "@riebeckite/plugin-related-posts";
|
|
34
|
+
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
// ...
|
|
37
|
+
plugins: [relatedPosts()],
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## オプション
|
|
42
|
+
|
|
43
|
+
| オプション | 型 | 既定値 | 説明 |
|
|
44
|
+
| ---------- | -- | ------ | ---- |
|
|
45
|
+
| `limit` | `number` | `5` | 表示する関連エントリの最大件数 |
|
|
46
|
+
| `minScore` | `number` | `1` | 表示に必要な最小スコア |
|
|
47
|
+
| `heading` | `boolean` | `true` | `<h2>` 見出しを出力する |
|
|
48
|
+
| `headingText` | `string` | `"Related"` | 見出しの文言 |
|
|
49
|
+
| `className` | `string` | `"rb-related-posts"` | ルート要素の CSS クラス |
|
|
50
|
+
| `useTags` | `boolean` | `true` | タグ共有のシグナルを使う |
|
|
51
|
+
| `useBacklinks` | `boolean` | `true` | 直接リンクのシグナルを使う |
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
relatedPosts({
|
|
55
|
+
limit: 8,
|
|
56
|
+
minScore: 2,
|
|
57
|
+
headingText: "関連ノート",
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 出力
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<nav class="rb-related-posts" data-related-posts>
|
|
65
|
+
<h2 class="rb-related-posts__heading">Related</h2>
|
|
66
|
+
<ul>
|
|
67
|
+
<li class="rb-related-posts__item">
|
|
68
|
+
<a class="rb-related-posts__link" href="/notes/example" data-related-score="5">Example Note</a>
|
|
69
|
+
</li>
|
|
70
|
+
</ul>
|
|
71
|
+
</nav>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## スタイル
|
|
75
|
+
|
|
76
|
+
パッケージに `style.css` が含まれます。他のプラグインと同じように読み込みます。
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import "@riebeckite/plugin-related-posts/style.css";
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## エクスポート
|
|
83
|
+
|
|
84
|
+
- `relatedPosts(options?)` — プラグインファクトリ
|
|
85
|
+
- `relatedPostsPlugin` — `relatedPosts` のエイリアス
|
|
86
|
+
- `resolveRelatedPostsOptions(options?)` — オプションの既定値を適用する
|
|
87
|
+
- `buildRelatedPosts({ manifest, entry, options, config? })` — 関連エントリを採点・整列する
|
|
88
|
+
- `renderRelatedPosts(entries, options)` — ナビゲーション HTML を生成する
|
|
89
|
+
- 型: `RelatedPostsOptions`, `ResolvedRelatedPostsOptions`, `RelatedPostsEntry`
|
|
90
|
+
|
|
91
|
+
## 制約
|
|
92
|
+
|
|
93
|
+
- 並び順はビルド時に確定します。再ビルドすれば常に正しく再計算されます。
|
|
94
|
+
- 判定材料はタグ・直接リンク・共引用のみです。読了時間や新しさ、フォルダは
|
|
95
|
+
順位を決定的に保つため意図的に使いません。
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RelatedPostsOptions } from "./src/types.js";
|
|
2
|
+
export { resolveRelatedPostsOptions } from "./src/options.js";
|
|
3
|
+
export { buildRelatedPosts, CO_CITATION_WEIGHT, DIRECT_LINK_WEIGHT, isEligibleRelatedEntry, SHARED_TAG_WEIGHT, } from "./src/related.js";
|
|
4
|
+
export { RELATED_POSTS_ATTRIBUTE, renderRelatedPosts, } from "./src/render.js";
|
|
5
|
+
export type { RelatedPostsEntry, RelatedPostsOptions, ResolvedRelatedPostsOptions, } from "./src/types.js";
|
|
6
|
+
export declare const RELATED_POSTS_PLUGIN_NAME = "related-posts";
|
|
7
|
+
/**
|
|
8
|
+
* Build-time "related notes" navigation.
|
|
9
|
+
*
|
|
10
|
+
* For every published entry it ranks the other entries in the manifest, then
|
|
11
|
+
* appends a `<nav>` section to both `entry.html` and the cached
|
|
12
|
+
* `PostContent.html` that the content route renders. No client runtime is
|
|
13
|
+
* required.
|
|
14
|
+
*/
|
|
15
|
+
export declare function relatedPosts(options?: RelatedPostsOptions): import("@riebeckite/core").RiebeckitePlugin<RelatedPostsOptions>;
|
|
16
|
+
/** Alias matching the `*Plugin` suffix used by other plugin factories. */
|
|
17
|
+
export declare const relatedPostsPlugin: typeof relatedPosts;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import {
|
|
3
|
+
createStyleAsset,
|
|
4
|
+
definePlugin
|
|
5
|
+
} from "@riebeckite/core";
|
|
6
|
+
|
|
7
|
+
// src/options.ts
|
|
8
|
+
var DEFAULT_RELATED_POSTS_LIMIT = 5;
|
|
9
|
+
var DEFAULT_RELATED_POSTS_MIN_SCORE = 1;
|
|
10
|
+
var DEFAULT_RELATED_POSTS_HEADING_TEXT = "Related";
|
|
11
|
+
var DEFAULT_RELATED_POSTS_CLASS_NAME = "rb-related-posts";
|
|
12
|
+
function resolveRelatedPostsOptions(options = {}) {
|
|
13
|
+
return {
|
|
14
|
+
limit: options.limit ?? DEFAULT_RELATED_POSTS_LIMIT,
|
|
15
|
+
minScore: options.minScore ?? DEFAULT_RELATED_POSTS_MIN_SCORE,
|
|
16
|
+
heading: options.heading ?? true,
|
|
17
|
+
headingText: options.headingText ?? DEFAULT_RELATED_POSTS_HEADING_TEXT,
|
|
18
|
+
className: normalizeClassName(options.className),
|
|
19
|
+
useTags: options.useTags ?? true,
|
|
20
|
+
useBacklinks: options.useBacklinks ?? true
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function normalizeClassName(className) {
|
|
24
|
+
if (typeof className !== "string") return DEFAULT_RELATED_POSTS_CLASS_NAME;
|
|
25
|
+
const trimmed = className.trim();
|
|
26
|
+
return trimmed === "" ? DEFAULT_RELATED_POSTS_CLASS_NAME : trimmed;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/related.ts
|
|
30
|
+
import {
|
|
31
|
+
isPublished
|
|
32
|
+
} from "@riebeckite/core";
|
|
33
|
+
var DIRECT_LINK_WEIGHT = 3;
|
|
34
|
+
var SHARED_TAG_WEIGHT = 2;
|
|
35
|
+
var CO_CITATION_WEIGHT = 1;
|
|
36
|
+
function buildRelatedPosts(args) {
|
|
37
|
+
const { manifest, entry, options } = args;
|
|
38
|
+
const scores = /* @__PURE__ */ new Map();
|
|
39
|
+
const outgoingTargets = collectNoteTargets(
|
|
40
|
+
manifest.outgoingLinks.get(entry.slug) ?? [],
|
|
41
|
+
entry.slug
|
|
42
|
+
);
|
|
43
|
+
if (options.useTags) {
|
|
44
|
+
for (const tag of entry.tags) {
|
|
45
|
+
for (const candidate of manifest.byTag.get(tag) ?? []) {
|
|
46
|
+
if (candidate.slug === entry.slug) continue;
|
|
47
|
+
addScore(scores, candidate.slug, SHARED_TAG_WEIGHT);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (options.useBacklinks) {
|
|
52
|
+
const incoming = manifest.incomingLinks.get(entry.slug) ?? [];
|
|
53
|
+
for (const slug of /* @__PURE__ */ new Set([...outgoingTargets, ...incoming])) {
|
|
54
|
+
if (slug === entry.slug) continue;
|
|
55
|
+
addScore(scores, slug, DIRECT_LINK_WEIGHT);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const target of outgoingTargets) {
|
|
59
|
+
for (const source of manifest.incomingLinks.get(target) ?? []) {
|
|
60
|
+
if (source === entry.slug) continue;
|
|
61
|
+
addScore(scores, source, CO_CITATION_WEIGHT);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const candidates = [];
|
|
65
|
+
for (const [slug, score] of scores) {
|
|
66
|
+
if (score < options.minScore) continue;
|
|
67
|
+
const candidate = manifest.bySlug.get(slug);
|
|
68
|
+
if (!candidate) continue;
|
|
69
|
+
if (!isEligibleRelatedEntry(candidate, manifest, args.config)) continue;
|
|
70
|
+
candidates.push({
|
|
71
|
+
slug: candidate.slug,
|
|
72
|
+
permalink: candidate.permalink,
|
|
73
|
+
title: candidate.title,
|
|
74
|
+
score
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
candidates.sort(compareRelatedEntries);
|
|
78
|
+
return candidates.slice(0, options.limit);
|
|
79
|
+
}
|
|
80
|
+
function isEligibleRelatedEntry(entry, manifest, config) {
|
|
81
|
+
if (manifest.redirects.has(entry.permalink)) return false;
|
|
82
|
+
if (config) return isPublished(config, entry.frontmatter);
|
|
83
|
+
return entry.frontmatter.private !== true && entry.frontmatter.draft !== true && entry.frontmatter.publish !== false;
|
|
84
|
+
}
|
|
85
|
+
function compareRelatedEntries(a, b) {
|
|
86
|
+
if (b.score !== a.score) return b.score - a.score;
|
|
87
|
+
const byTitle = a.title.localeCompare(b.title);
|
|
88
|
+
if (byTitle !== 0) return byTitle;
|
|
89
|
+
return a.slug.localeCompare(b.slug);
|
|
90
|
+
}
|
|
91
|
+
function collectNoteTargets(links, sourceSlug) {
|
|
92
|
+
const targets = /* @__PURE__ */ new Set();
|
|
93
|
+
for (const link of links) {
|
|
94
|
+
if (link.kind !== "note" || link.slug === null) continue;
|
|
95
|
+
if (link.slug === sourceSlug) continue;
|
|
96
|
+
targets.add(link.slug);
|
|
97
|
+
}
|
|
98
|
+
return [...targets];
|
|
99
|
+
}
|
|
100
|
+
function addScore(scores, slug, weight) {
|
|
101
|
+
scores.set(slug, (scores.get(slug) ?? 0) + weight);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/render.ts
|
|
105
|
+
import { escapeHtml, escapeHtmlAttribute } from "@riebeckite/core";
|
|
106
|
+
var RELATED_POSTS_ATTRIBUTE = "data-related-posts";
|
|
107
|
+
function renderRelatedPosts(entries, options) {
|
|
108
|
+
if (entries.length === 0) return "";
|
|
109
|
+
const className = escapeHtmlAttribute(options.className);
|
|
110
|
+
const heading = options.heading ? `<h2 class="${className}__heading">${escapeHtml(options.headingText)}</h2>` : "";
|
|
111
|
+
const items = entries.map(
|
|
112
|
+
(entry) => `<li class="${className}__item"><a class="${className}__link" href="${escapeHtmlAttribute(
|
|
113
|
+
entry.permalink
|
|
114
|
+
)}" data-related-score="${entry.score}">${escapeHtml(entry.title)}</a></li>`
|
|
115
|
+
).join("");
|
|
116
|
+
return `<nav class="${className}" ${RELATED_POSTS_ATTRIBUTE}>${heading}<ul>${items}</ul></nav>`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// index.ts
|
|
120
|
+
var RELATED_POSTS_PLUGIN_NAME = "related-posts";
|
|
121
|
+
function relatedPosts(options = {}) {
|
|
122
|
+
const resolved = resolveRelatedPostsOptions(options);
|
|
123
|
+
const processed = /* @__PURE__ */ new Map();
|
|
124
|
+
return definePlugin({
|
|
125
|
+
name: RELATED_POSTS_PLUGIN_NAME,
|
|
126
|
+
options,
|
|
127
|
+
validateOptions: validateRelatedPostsOptions,
|
|
128
|
+
onPostProcessed: (context) => {
|
|
129
|
+
processed.set(context.slug, context.content);
|
|
130
|
+
},
|
|
131
|
+
onManifestCreated: (context) => {
|
|
132
|
+
const { manifest } = context;
|
|
133
|
+
for (const entry of manifest.entries) {
|
|
134
|
+
if (entry.html.includes(RELATED_POSTS_ATTRIBUTE)) continue;
|
|
135
|
+
if (!isEligibleRelatedEntry(entry, manifest, context.config)) continue;
|
|
136
|
+
const related = buildRelatedPosts({
|
|
137
|
+
manifest,
|
|
138
|
+
entry,
|
|
139
|
+
options: resolved,
|
|
140
|
+
config: context.config
|
|
141
|
+
});
|
|
142
|
+
if (related.length === 0) continue;
|
|
143
|
+
entry.html = `${entry.html}${renderRelatedPosts(related, resolved)}`;
|
|
144
|
+
const content = processed.get(entry.slug);
|
|
145
|
+
if (content) content.html = entry.html;
|
|
146
|
+
}
|
|
147
|
+
processed.clear();
|
|
148
|
+
},
|
|
149
|
+
assets: [createStyleAsset(RELATED_POSTS_PLUGIN_NAME)]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
var relatedPostsPlugin = relatedPosts;
|
|
153
|
+
function validateRelatedPostsOptions(options) {
|
|
154
|
+
if (!options) return [];
|
|
155
|
+
const issues = [];
|
|
156
|
+
if (options.limit !== void 0 && (!Number.isInteger(options.limit) || options.limit < 0)) {
|
|
157
|
+
issues.push({ path: "limit", message: "Expected a non-negative integer." });
|
|
158
|
+
}
|
|
159
|
+
if (options.minScore !== void 0 && (!Number.isFinite(options.minScore) || options.minScore < 0)) {
|
|
160
|
+
issues.push({
|
|
161
|
+
path: "minScore",
|
|
162
|
+
message: "Expected a non-negative finite number."
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (options.heading !== void 0 && typeof options.heading !== "boolean") {
|
|
166
|
+
issues.push({ path: "heading", message: "Expected a boolean." });
|
|
167
|
+
}
|
|
168
|
+
if (options.headingText !== void 0 && (typeof options.headingText !== "string" || options.headingText.trim() === "")) {
|
|
169
|
+
issues.push({
|
|
170
|
+
path: "headingText",
|
|
171
|
+
message: "Expected a non-empty string."
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (options.className !== void 0 && (typeof options.className !== "string" || options.className.trim() === "")) {
|
|
175
|
+
issues.push({ path: "className", message: "Expected a non-empty string." });
|
|
176
|
+
}
|
|
177
|
+
if (options.useTags !== void 0 && typeof options.useTags !== "boolean") {
|
|
178
|
+
issues.push({ path: "useTags", message: "Expected a boolean." });
|
|
179
|
+
}
|
|
180
|
+
if (options.useBacklinks !== void 0 && typeof options.useBacklinks !== "boolean") {
|
|
181
|
+
issues.push({ path: "useBacklinks", message: "Expected a boolean." });
|
|
182
|
+
}
|
|
183
|
+
return issues;
|
|
184
|
+
}
|
|
185
|
+
export {
|
|
186
|
+
CO_CITATION_WEIGHT,
|
|
187
|
+
DIRECT_LINK_WEIGHT,
|
|
188
|
+
RELATED_POSTS_ATTRIBUTE,
|
|
189
|
+
RELATED_POSTS_PLUGIN_NAME,
|
|
190
|
+
SHARED_TAG_WEIGHT,
|
|
191
|
+
buildRelatedPosts,
|
|
192
|
+
isEligibleRelatedEntry,
|
|
193
|
+
relatedPosts,
|
|
194
|
+
relatedPostsPlugin,
|
|
195
|
+
renderRelatedPosts,
|
|
196
|
+
resolveRelatedPostsOptions
|
|
197
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RelatedPostsOptions, ResolvedRelatedPostsOptions } from "./types.js";
|
|
2
|
+
export declare const DEFAULT_RELATED_POSTS_LIMIT = 5;
|
|
3
|
+
export declare const DEFAULT_RELATED_POSTS_MIN_SCORE = 1;
|
|
4
|
+
export declare const DEFAULT_RELATED_POSTS_HEADING_TEXT = "Related";
|
|
5
|
+
export declare const DEFAULT_RELATED_POSTS_CLASS_NAME = "rb-related-posts";
|
|
6
|
+
/**
|
|
7
|
+
* Applies defaults to `RelatedPostsOptions`. Pure and deterministic so the
|
|
8
|
+
* plugin can resolve options once and reuse them for every manifest entry.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveRelatedPostsOptions(options?: RelatedPostsOptions): ResolvedRelatedPostsOptions;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ContentManifest, type ContentManifestEntry, type ResolvedRiebeckiteConfig } from "@riebeckite/core";
|
|
2
|
+
import type { RelatedPostsEntry, ResolvedRelatedPostsOptions } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Weights are deterministic constants: the same manifest always produces the
|
|
5
|
+
* same ranking. A direct link is the strongest signal, a shared tag is next,
|
|
6
|
+
* and a co-citation (both entries linking to the same note) is the weakest.
|
|
7
|
+
*/
|
|
8
|
+
/** Added once for each entry reachable through a direct link. */
|
|
9
|
+
export declare const DIRECT_LINK_WEIGHT = 3;
|
|
10
|
+
/** Added once per tag shared with the source entry. */
|
|
11
|
+
export declare const SHARED_TAG_WEIGHT = 2;
|
|
12
|
+
/** Added once per note that both entries link to. */
|
|
13
|
+
export declare const CO_CITATION_WEIGHT = 1;
|
|
14
|
+
export type BuildRelatedPostsArgs = {
|
|
15
|
+
manifest: ContentManifest;
|
|
16
|
+
entry: ContentManifestEntry;
|
|
17
|
+
options: ResolvedRelatedPostsOptions;
|
|
18
|
+
config?: ResolvedRiebeckiteConfig;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Ranks the published entries related to `entry` using the manifest's content
|
|
22
|
+
* graph. Pure build-time computation: it only reads `byTag`, `outgoingLinks`,
|
|
23
|
+
* `incomingLinks`, `redirects`, and `bySlug`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildRelatedPosts(args: BuildRelatedPostsArgs): RelatedPostsEntry[];
|
|
26
|
+
/**
|
|
27
|
+
* An entry may receive a related-posts section (and be offered as a related
|
|
28
|
+
* candidate) only when it is published and its canonical permalink is not
|
|
29
|
+
* shadowed by a redirect. Unpublished and redirect-only entries are skipped.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isEligibleRelatedEntry(entry: ContentManifestEntry, manifest: ContentManifest, config?: ResolvedRiebeckiteConfig): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RelatedPostsEntry, ResolvedRelatedPostsOptions } from "./types.js";
|
|
2
|
+
/** Boolean attribute that marks the generated navigation for tests and styling. */
|
|
3
|
+
export declare const RELATED_POSTS_ATTRIBUTE = "data-related-posts";
|
|
4
|
+
/**
|
|
5
|
+
* Renders the related-posts navigation. Returns an empty string when there is
|
|
6
|
+
* nothing to show, so callers can leave an entry's HTML untouched.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderRelatedPosts(entries: readonly RelatedPostsEntry[], options: ResolvedRelatedPostsOptions): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Options accepted by `relatedPosts()`. */
|
|
2
|
+
export type RelatedPostsOptions = {
|
|
3
|
+
/** Maximum number of related entries to render. Defaults to `5`. */
|
|
4
|
+
limit?: number;
|
|
5
|
+
/** Minimum score a candidate must reach to be listed. Defaults to `1`. */
|
|
6
|
+
minScore?: number;
|
|
7
|
+
/** Render the `<h2>` heading. Defaults to `true`. */
|
|
8
|
+
heading?: boolean;
|
|
9
|
+
/** Heading text. Defaults to `"Related"`. */
|
|
10
|
+
headingText?: string;
|
|
11
|
+
/** Root CSS class of the generated `<nav>`. Defaults to `"rb-related-posts"`. */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Use shared tags as a relatedness signal. Defaults to `true`. */
|
|
14
|
+
useTags?: boolean;
|
|
15
|
+
/** Use direct links (outgoing and incoming) as a relatedness signal. Defaults to `true`. */
|
|
16
|
+
useBacklinks?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** `RelatedPostsOptions` with every default applied. */
|
|
19
|
+
export type ResolvedRelatedPostsOptions = {
|
|
20
|
+
limit: number;
|
|
21
|
+
minScore: number;
|
|
22
|
+
heading: boolean;
|
|
23
|
+
headingText: string;
|
|
24
|
+
className: string;
|
|
25
|
+
useTags: boolean;
|
|
26
|
+
useBacklinks: boolean;
|
|
27
|
+
};
|
|
28
|
+
/** A single ranked related entry, ready to render. */
|
|
29
|
+
export type RelatedPostsEntry = {
|
|
30
|
+
slug: string;
|
|
31
|
+
permalink: string;
|
|
32
|
+
title: string;
|
|
33
|
+
/** Deterministic non-negative score used for ranking and `data-related-score`. */
|
|
34
|
+
score: number;
|
|
35
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@riebeckite/plugin-related-posts",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"source": "./index.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./style.css": "./style.css"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@riebeckite/core": "0.0.1"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md",
|
|
26
|
+
"README_ja.md",
|
|
27
|
+
"dist",
|
|
28
|
+
"style.css"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/Rerurate514/riebeckite.git",
|
|
33
|
+
"directory": "packages/plugins/related-posts"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/Rerurate514/riebeckite#readme",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/Rerurate514/riebeckite/issues"
|
|
38
|
+
},
|
|
39
|
+
"description": "Build-time related-post navigation for Riebeckite.",
|
|
40
|
+
"keywords": [
|
|
41
|
+
"riebeckite",
|
|
42
|
+
"plugin",
|
|
43
|
+
"related-posts",
|
|
44
|
+
"navigation"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
48
|
+
},
|
|
49
|
+
"sideEffects": [
|
|
50
|
+
"./style.css"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "node ../../../scripts/build_package.mjs"
|
|
54
|
+
}
|
|
55
|
+
}
|
package/style.css
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.rb-related-posts {
|
|
2
|
+
--rb-related-posts-ink: var(--rb-color-ink, #000000);
|
|
3
|
+
--rb-related-posts-muted: var(--rb-color-muted, #69645c);
|
|
4
|
+
--rb-related-posts-rule: color-mix(
|
|
5
|
+
in srgb,
|
|
6
|
+
var(--rb-related-posts-ink) 16%,
|
|
7
|
+
transparent
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
margin-top: 3rem;
|
|
11
|
+
padding-top: 1.5rem;
|
|
12
|
+
border-top: 1px solid var(--rb-related-posts-rule);
|
|
13
|
+
color: var(--rb-related-posts-ink);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.rb-related-posts__heading {
|
|
17
|
+
margin: 0 0 1rem;
|
|
18
|
+
font-size: 1.125rem;
|
|
19
|
+
font-weight: 700;
|
|
20
|
+
letter-spacing: 0.02em;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.rb-related-posts ul {
|
|
24
|
+
display: grid;
|
|
25
|
+
gap: 0.5rem;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
list-style: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.rb-related-posts__item {
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.rb-related-posts__link {
|
|
37
|
+
color: inherit;
|
|
38
|
+
text-decoration: underline;
|
|
39
|
+
text-decoration-color: var(--rb-related-posts-rule);
|
|
40
|
+
text-underline-offset: 0.2em;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.rb-related-posts__link:hover,
|
|
44
|
+
.rb-related-posts__link:focus-visible {
|
|
45
|
+
text-decoration-color: var(--rb-related-posts-muted);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
html[data-theme="dark"] .rb-related-posts,
|
|
49
|
+
html.dark .rb-related-posts {
|
|
50
|
+
--rb-related-posts-ink: var(--rb-color-paper, #ffffff);
|
|
51
|
+
}
|