@riebeckite/plugin-taxonomy 0.0.21 → 0.0.23
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 +5 -13
- package/README_ja.md +5 -13
- package/dist/index.js +55 -13
- package/dist/src/feeds.d.ts +1 -1
- package/dist/src/url.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @riebeckite/plugin-taxonomy
|
|
2
2
|
|
|
3
|
+
<!-- Generated from docs/docs/plugins/taxonomy.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
|
+
|
|
3
5
|
Build-time tag and folder taxonomy for Riebeckite: listing data, per-term
|
|
4
6
|
RSS / Atom / JSON feeds, related-tag navigation, and SEO metadata. No
|
|
5
7
|
client-side JavaScript is required.
|
|
@@ -111,17 +113,7 @@ summary as `content_text` and do not duplicate rendered article HTML.
|
|
|
111
113
|
|
|
112
114
|
When `related` is enabled, each tag term carries tags that co-occur on the same
|
|
113
115
|
entries, ranked by shared-entry count then alphabetically, clamped to
|
|
114
|
-
`relatedLimit`. Related navigation is rendered by `renderTaxonomyPage
|
|
115
|
-
|
|
116
|
-
```html
|
|
117
|
-
<nav class="rr-taxonomy__related" aria-label="Related tags" data-rr-taxonomy-related>
|
|
118
|
-
<ul>
|
|
119
|
-
<li class="rr-taxonomy__related-item">
|
|
120
|
-
<a class="rr-taxonomy__related-link" href="/tags/featured" data-rr-taxonomy-related-count="2">#featured</a>
|
|
121
|
-
</li>
|
|
122
|
-
</ul>
|
|
123
|
-
</nav>
|
|
124
|
-
```
|
|
116
|
+
`relatedLimit`. Related navigation is rendered by `renderTaxonomyPage` on each taxonomy term page. Visit a tag page with co-occurring tags to see the live navigation.
|
|
125
117
|
|
|
126
118
|
## SEO
|
|
127
119
|
|
|
@@ -188,5 +180,5 @@ import "@riebeckite/plugin-taxonomy/style.css";
|
|
|
188
180
|
|
|
189
181
|
## See also
|
|
190
182
|
|
|
191
|
-
- [Plugin guide](
|
|
192
|
-
- [Content system](
|
|
183
|
+
- [Plugin guide](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.md)
|
|
184
|
+
- [Content system](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/framework/content-system.md)
|
package/README_ja.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @riebeckite/plugin-taxonomy
|
|
2
2
|
|
|
3
|
+
<!-- Generated from docs/docs/plugins/taxonomy.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
|
+
|
|
3
5
|
Riebeckite のビルド時タクソノミー(タグ・フォルダ)プラグインです。一覧用データ、
|
|
4
6
|
語ごとの RSS / Atom / JSON フィード、関連タグナビゲーション、SEO メタデータを
|
|
5
7
|
生成します。クライアント JavaScript は不要です。
|
|
@@ -111,17 +113,7 @@ GET /taxonomy/index.json
|
|
|
111
113
|
|
|
112
114
|
`related` が有効なとき、各タグ語は同じエントリに共起するタグを保持します。共起
|
|
113
115
|
エントリ数で降順、同数ならアルファベット順に並べ、`relatedLimit` で打ち切ります。
|
|
114
|
-
ナビゲーションは `renderTaxonomyPage`
|
|
115
|
-
|
|
116
|
-
```html
|
|
117
|
-
<nav class="rr-taxonomy__related" aria-label="Related tags" data-rr-taxonomy-related>
|
|
118
|
-
<ul>
|
|
119
|
-
<li class="rr-taxonomy__related-item">
|
|
120
|
-
<a class="rr-taxonomy__related-link" href="/tags/featured" data-rr-taxonomy-related-count="2">#featured</a>
|
|
121
|
-
</li>
|
|
122
|
-
</ul>
|
|
123
|
-
</nav>
|
|
124
|
-
```
|
|
116
|
+
ナビゲーションは `renderTaxonomyPage` が各 taxonomy term ページで実際に描画します。共起するタグがあるタグページで確認できます。
|
|
125
117
|
|
|
126
118
|
## SEO
|
|
127
119
|
|
|
@@ -188,5 +180,5 @@ import "@riebeckite/plugin-taxonomy/style.css";
|
|
|
188
180
|
|
|
189
181
|
## 関連
|
|
190
182
|
|
|
191
|
-
- [プラグインガイド](
|
|
192
|
-
- [コンテンツシステム](
|
|
183
|
+
- [プラグインガイド](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.ja.md)
|
|
184
|
+
- [コンテンツシステム](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/framework/content-system.ja.md)
|
package/dist/index.js
CHANGED
|
@@ -499,7 +499,6 @@ function buildDescription(term) {
|
|
|
499
499
|
var TAXONOMY_PLUGIN_NAME = "taxonomy";
|
|
500
500
|
function taxonomy(options = {}) {
|
|
501
501
|
const resolved = resolveTaxonomyOptions(options);
|
|
502
|
-
const emittedFeeds = /* @__PURE__ */ new Set();
|
|
503
502
|
return definePlugin({
|
|
504
503
|
name: TAXONOMY_PLUGIN_NAME,
|
|
505
504
|
options,
|
|
@@ -509,7 +508,14 @@ function taxonomy(options = {}) {
|
|
|
509
508
|
{
|
|
510
509
|
id: "taxonomy-term",
|
|
511
510
|
paths: ({ manifest }) => taxonomyPagePaths(manifest.discoverableEntries, resolved),
|
|
512
|
-
outputDependencies:
|
|
511
|
+
outputDependencies: ({ manifest, pathname }) => {
|
|
512
|
+
const term = findTaxonomyTerm(
|
|
513
|
+
manifest.discoverableEntries,
|
|
514
|
+
resolved,
|
|
515
|
+
pathname
|
|
516
|
+
);
|
|
517
|
+
return term ? taxonomyPageOutputDependencies(term, resolved.related) : [{ type: "unknown" }];
|
|
518
|
+
},
|
|
513
519
|
resolve: ({ manifest, pathname }) => {
|
|
514
520
|
const term = findTaxonomyTerm(
|
|
515
521
|
manifest.discoverableEntries,
|
|
@@ -530,7 +536,14 @@ function taxonomy(options = {}) {
|
|
|
530
536
|
{
|
|
531
537
|
id: "taxonomy-index",
|
|
532
538
|
paths: () => taxonomyIndexPagePaths(resolved),
|
|
533
|
-
outputDependencies:
|
|
539
|
+
outputDependencies: ({ pathname }) => {
|
|
540
|
+
const kind = resolveTaxonomyIndexPath(pathname, resolved);
|
|
541
|
+
const dependency = kind === "tag" ? { type: "projection", projection: "taxonomy-tags" } : kind === "folder" ? {
|
|
542
|
+
type: "projection",
|
|
543
|
+
projection: "taxonomy-folders"
|
|
544
|
+
} : void 0;
|
|
545
|
+
return dependency ? [...pageProjectionDependencies, dependency] : [{ type: "unknown" }];
|
|
546
|
+
},
|
|
534
547
|
resolve: ({ manifest, pathname }) => {
|
|
535
548
|
const kind = resolveTaxonomyIndexPath(pathname, resolved);
|
|
536
549
|
if (!kind) return null;
|
|
@@ -552,24 +565,36 @@ function taxonomy(options = {}) {
|
|
|
552
565
|
}
|
|
553
566
|
}
|
|
554
567
|
],
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
568
|
+
planGeneratedOutputs(context) {
|
|
569
|
+
if (!context.site) return [];
|
|
570
|
+
const index = buildTaxonomyIndex(
|
|
571
|
+
context.manifest.discoverableEntries,
|
|
572
|
+
resolved
|
|
573
|
+
);
|
|
574
|
+
const outputs = [];
|
|
559
575
|
for (const term of [...index.tags, ...index.folders]) {
|
|
560
576
|
for (const format of enabledFormats(resolved)) {
|
|
561
577
|
const path = feedFilePath(term.path, format);
|
|
562
|
-
|
|
563
|
-
emittedFeeds.add(path);
|
|
564
|
-
context.output.emit({
|
|
578
|
+
outputs.push({
|
|
565
579
|
path,
|
|
566
|
-
content: renderTermFeed(
|
|
567
|
-
|
|
580
|
+
content: renderTermFeed(
|
|
581
|
+
{ site: context.site },
|
|
582
|
+
term,
|
|
583
|
+
format,
|
|
584
|
+
resolved.feedLimit
|
|
585
|
+
),
|
|
586
|
+
dependencies: taxonomyOutputDependencies(term)
|
|
568
587
|
});
|
|
569
588
|
}
|
|
570
589
|
}
|
|
590
|
+
return outputs;
|
|
571
591
|
},
|
|
572
|
-
assets: [
|
|
592
|
+
assets: [
|
|
593
|
+
createStyleAsset(
|
|
594
|
+
TAXONOMY_PLUGIN_NAME,
|
|
595
|
+
"@riebeckite/plugin-taxonomy/style.css"
|
|
596
|
+
)
|
|
597
|
+
]
|
|
573
598
|
});
|
|
574
599
|
}
|
|
575
600
|
var taxonomyPlugin = taxonomy;
|
|
@@ -577,6 +602,23 @@ function taxonomyPagePaths(entries, options) {
|
|
|
577
602
|
const index = buildTaxonomyIndex(entries, options);
|
|
578
603
|
return [...index.tags, ...index.folders].map((term) => term.path);
|
|
579
604
|
}
|
|
605
|
+
function taxonomyOutputDependencies(term) {
|
|
606
|
+
return [
|
|
607
|
+
term.kind === "tag" ? { type: "tag", tag: term.value } : { type: "folder", folder: term.value }
|
|
608
|
+
];
|
|
609
|
+
}
|
|
610
|
+
function taxonomyPageOutputDependencies(term, related) {
|
|
611
|
+
const relatedDependencies = related && term.kind === "tag" ? [{ type: "projection", projection: "taxonomy-tags" }] : [];
|
|
612
|
+
return [
|
|
613
|
+
...pageProjectionDependencies,
|
|
614
|
+
...taxonomyOutputDependencies(term),
|
|
615
|
+
...relatedDependencies
|
|
616
|
+
];
|
|
617
|
+
}
|
|
618
|
+
var pageProjectionDependencies = [
|
|
619
|
+
{ type: "projection", projection: "navigation" },
|
|
620
|
+
{ type: "projection", projection: "recent-posts" }
|
|
621
|
+
];
|
|
580
622
|
function findTaxonomyTerm(entries, options, pathname) {
|
|
581
623
|
const index = buildTaxonomyIndex(entries, options);
|
|
582
624
|
return [...index.tags, ...index.folders].find(
|
package/dist/src/feeds.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import type { TaxonomyFeedFormat, TaxonomyHeadTag, TaxonomyTerm } from "./types.
|
|
|
5
5
|
* link so a tag subscription is distinguishable from the site-wide feed that
|
|
6
6
|
* `@riebeckite/plugin-seo` owns.
|
|
7
7
|
*/
|
|
8
|
-
export declare function renderTermFeed(config: ResolvedRiebeckiteConfig, term: TaxonomyTerm, format: TaxonomyFeedFormat, limit?: number): string;
|
|
8
|
+
export declare function renderTermFeed(config: Pick<ResolvedRiebeckiteConfig, "site">, term: TaxonomyTerm, format: TaxonomyFeedFormat, limit?: number): string;
|
|
9
9
|
/** Builds the `<link rel="alternate">` discovery tags for a term. */
|
|
10
10
|
export declare function buildFeedHeadTags(term: TaxonomyTerm): TaxonomyHeadTag[];
|
package/dist/src/url.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import type { ResolvedRiebeckiteConfig } from "@riebeckite/core";
|
|
|
4
4
|
* SEO plugin's absolute-URL convention so taxonomy feeds and metadata match the
|
|
5
5
|
* rest of the site without depending on the SEO package.
|
|
6
6
|
*/
|
|
7
|
-
export declare function buildTaxonomyAbsoluteUrl(config: ResolvedRiebeckiteConfig, pathOrUrl: string): string;
|
|
7
|
+
export declare function buildTaxonomyAbsoluteUrl(config: Pick<ResolvedRiebeckiteConfig, "site">, pathOrUrl: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-taxonomy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"./style.css": "./style.css"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@riebeckite/core": "0.0.
|
|
18
|
+
"@riebeckite/core": "0.0.23"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tsx": "^4.22.4"
|