@riebeckite/plugin-taxonomy 0.0.14 → 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 +8 -10
- package/README_ja.md +8 -9
- package/dist/index.d.ts +0 -1
- package/dist/index.js +8 -51
- package/dist/src/types.d.ts +0 -3
- package/package.json +2 -2
- package/dist/src/locations.d.ts +0 -14
package/README.md
CHANGED
|
@@ -35,7 +35,6 @@ export default defineConfig({
|
|
|
35
35
|
tags: true,
|
|
36
36
|
folders: true,
|
|
37
37
|
related: true,
|
|
38
|
-
folderIndexes: true,
|
|
39
38
|
}),
|
|
40
39
|
],
|
|
41
40
|
});
|
|
@@ -53,7 +52,6 @@ export default defineConfig({
|
|
|
53
52
|
| `minEntries` | `number` | `1` | Drop terms with fewer entries |
|
|
54
53
|
| `related` | `boolean` | `true` | Compute related-tag navigation |
|
|
55
54
|
| `relatedLimit` | `number` | `8` | Maximum related tags per tag |
|
|
56
|
-
| `folderIndexes` | `boolean` | `false` | Resolve `<folder>/index.md` to `/<folder>` |
|
|
57
55
|
| `feeds` | `{ rss?, atom?, json? }` | all `true` | Per-term feed formats |
|
|
58
56
|
| `feedLimit` | `number` | `50` | Maximum entries per feed |
|
|
59
57
|
| `resolveTitle` | `(context) => string` | `#value` / path | Custom term title |
|
|
@@ -133,11 +131,11 @@ provider is registered.
|
|
|
133
131
|
|
|
134
132
|
## Folder index notes
|
|
135
133
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
Folder entry resolution is owned by
|
|
135
|
+
[`@riebeckite/plugin-folder-pages`](../folder-pages/README.md), so taxonomy only
|
|
136
|
+
generates tag and folder terms from the manifest's public view. Enable that
|
|
137
|
+
plugin when a note at `<folder>/README.md` or `<folder>/index.md` should become
|
|
138
|
+
the folder's landing page.
|
|
141
139
|
|
|
142
140
|
## Page types
|
|
143
141
|
|
|
@@ -171,7 +169,6 @@ import "@riebeckite/plugin-taxonomy/style.css";
|
|
|
171
169
|
- `renderTaxonomyPage(term, options)` / `renderRelatedTerms(term, options)` — page fragments
|
|
172
170
|
- `renderTermFeed(config, term, format, limit?)` / `buildFeedHeadTags(term)` — per-term feeds
|
|
173
171
|
- `buildTaxonomySeo(config, term)` — listing-page SEO metadata
|
|
174
|
-
- `resolveFolderIndexLocations(entries, options, diagnostics)` — folder-index location strategy
|
|
175
172
|
- `slugifyTaxonomyValue(value)` — URL/file slug
|
|
176
173
|
- `buildTaxonomyAbsoluteUrl(config, pathOrUrl)` — absolute URLs
|
|
177
174
|
- Types: `TaxonomyOptions`, `ResolvedTaxonomyOptions`, `TaxonomyTerm`, `TaxonomyIndex`, `TaxonomyPage`, `TaxonomyTermData`, `TaxonomyIndexData`
|
|
@@ -186,5 +183,6 @@ import "@riebeckite/plugin-taxonomy/style.css";
|
|
|
186
183
|
|
|
187
184
|
## See also
|
|
188
185
|
|
|
189
|
-
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
|
190
|
-
- [Content system](../../../docs/en/framework/content-system.md)
|
|
186
|
+
- [Plugin guide](../../../docs/en/docs/reference/plugin-api.md)
|
|
187
|
+
- [Content system](../../../docs/en/docs/framework/content-system.md)
|
|
188
|
+
|
package/README_ja.md
CHANGED
|
@@ -36,7 +36,6 @@ export default defineConfig({
|
|
|
36
36
|
tags: true,
|
|
37
37
|
folders: true,
|
|
38
38
|
related: true,
|
|
39
|
-
folderIndexes: true,
|
|
40
39
|
}),
|
|
41
40
|
],
|
|
42
41
|
});
|
|
@@ -54,7 +53,6 @@ export default defineConfig({
|
|
|
54
53
|
| `minEntries` | `number` | `1` | これ未満のエントリ数しかない語を除外する |
|
|
55
54
|
| `related` | `boolean` | `true` | 関連タグナビゲーションを生成する |
|
|
56
55
|
| `relatedLimit` | `number` | `8` | タグごとの関連タグ上限 |
|
|
57
|
-
| `folderIndexes` | `boolean` | `false` | `<folder>/index.md` を `/<folder>` に解決する |
|
|
58
56
|
| `feeds` | `{ rss?, atom?, json? }` | すべて `true` | 語ごとのフィード形式 |
|
|
59
57
|
| `feedLimit` | `number` | `50` | フィードあたりの最大エントリ数 |
|
|
60
58
|
| `resolveTitle` | `(context) => string` | `#value` / パス | 語の表示タイトル |
|
|
@@ -132,10 +130,11 @@ Core `seo` 拡張ポイント(たとえば `@riebeckite/plugin-seo`)へ委
|
|
|
132
130
|
|
|
133
131
|
## フォルダ index note
|
|
134
132
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
フォルダ入口の解決は
|
|
134
|
+
[`@riebeckite/plugin-folder-pages`](../folder-pages/README_ja.md) が所有します。
|
|
135
|
+
taxonomy はマニフェストの公開ビューからタグ語とフォルダ語だけを生成します。
|
|
136
|
+
`<folder>/README.md` や `<folder>/index.md` をフォルダのランディングページに
|
|
137
|
+
する場合は、そのプラグインを有効にしてください。
|
|
139
138
|
|
|
140
139
|
## Page Type
|
|
141
140
|
|
|
@@ -169,7 +168,6 @@ import "@riebeckite/plugin-taxonomy/style.css";
|
|
|
169
168
|
- `renderTaxonomyPage(term, options)` / `renderRelatedTerms(term, options)` — ページ断片
|
|
170
169
|
- `renderTermFeed(config, term, format, limit?)` / `buildFeedHeadTags(term)` — 語ごとのフィード
|
|
171
170
|
- `buildTaxonomySeo(config, term)` — 一覧ページの SEO メタデータ
|
|
172
|
-
- `resolveFolderIndexLocations(entries, options, diagnostics)` — フォルダ index の location 戦略
|
|
173
171
|
- `slugifyTaxonomyValue(value)` — URL・ファイル用の slug
|
|
174
172
|
- `buildTaxonomyAbsoluteUrl(config, pathOrUrl)` — 絶対 URL
|
|
175
173
|
- 型: `TaxonomyOptions`, `ResolvedTaxonomyOptions`, `TaxonomyTerm`, `TaxonomyIndex`, `TaxonomyPage`, `TaxonomyTermData`, `TaxonomyIndexData`
|
|
@@ -185,5 +183,6 @@ import "@riebeckite/plugin-taxonomy/style.css";
|
|
|
185
183
|
|
|
186
184
|
## 関連
|
|
187
185
|
|
|
188
|
-
- [プラグインガイド](../../../docs/ja/reference/plugin-api.md)
|
|
189
|
-
- [コンテンツシステム](../../../docs/ja/framework/content-system.md)
|
|
186
|
+
- [プラグインガイド](../../../docs/ja/docs/reference/plugin-api.md)
|
|
187
|
+
- [コンテンツシステム](../../../docs/ja/docs/framework/content-system.md)
|
|
188
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { type ResolvedRiebeckiteConfig } from "@riebeckite/core";
|
|
|
2
2
|
import type { ResolvedTaxonomyOptions, TaxonomyOptions } from "./src/types.js";
|
|
3
3
|
export { buildTaxonomyIndex, serializeTaxonomyIndex, serializeTaxonomyTerm, toEntryReference, } from "./src/collections.js";
|
|
4
4
|
export { buildFeedHeadTags, renderTermFeed } from "./src/feeds.js";
|
|
5
|
-
export { resolveFolderIndexLocations } from "./src/locations.js";
|
|
6
5
|
export { DEFAULT_TAXONOMY_CLASS_NAME, DEFAULT_TAXONOMY_DATA_ENDPOINT, DEFAULT_TAXONOMY_FEED_LIMIT, DEFAULT_TAXONOMY_FOLDERS_BASE_PATH, DEFAULT_TAXONOMY_MIN_ENTRIES, DEFAULT_TAXONOMY_RELATED_LIMIT, DEFAULT_TAXONOMY_TAGS_BASE_PATH, resolveTaxonomyOptions, } from "./src/options.js";
|
|
7
6
|
export { renderRelatedTerms, renderTaxonomyPage } from "./src/pages.js";
|
|
8
7
|
export { buildTaxonomySeo } from "./src/seo.js";
|
package/dist/index.js
CHANGED
|
@@ -324,48 +324,6 @@ function toIso(value) {
|
|
|
324
324
|
return Number.isNaN(date.getTime()) ? null : date.toISOString();
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
// src/locations.ts
|
|
328
|
-
import {
|
|
329
|
-
resolveDefaultContentLocation
|
|
330
|
-
} from "@riebeckite/core";
|
|
331
|
-
var PLUGIN_NAME = "taxonomy";
|
|
332
|
-
function resolveFolderIndexLocations(entries, options, diagnostics) {
|
|
333
|
-
if (!options.folderIndexes) return [];
|
|
334
|
-
const permalinkOwners = /* @__PURE__ */ new Map();
|
|
335
|
-
for (const entry of entries) {
|
|
336
|
-
const location = resolveDefaultContentLocation(entry);
|
|
337
|
-
if (!permalinkOwners.has(location.permalink)) {
|
|
338
|
-
permalinkOwners.set(location.permalink, entry.slug);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
const locations = [];
|
|
342
|
-
for (const entry of entries) {
|
|
343
|
-
const suffix = "/index";
|
|
344
|
-
if (!entry.slug.endsWith(suffix)) continue;
|
|
345
|
-
const folder = entry.slug.slice(0, -suffix.length);
|
|
346
|
-
if (folder === "") continue;
|
|
347
|
-
const target = `/${folder}`;
|
|
348
|
-
const owner = permalinkOwners.get(target);
|
|
349
|
-
if (owner && owner !== entry.slug) {
|
|
350
|
-
diagnostics.push({
|
|
351
|
-
code: "taxonomy-folder-index-collision",
|
|
352
|
-
severity: "warning",
|
|
353
|
-
pluginName: PLUGIN_NAME,
|
|
354
|
-
message: `Folder index "${entry.path}" already maps to a note at "${target}"; keeping the default location.`,
|
|
355
|
-
slug: entry.slug,
|
|
356
|
-
target
|
|
357
|
-
});
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
locations.push({
|
|
361
|
-
slug: entry.slug,
|
|
362
|
-
permalink: target,
|
|
363
|
-
metadata: { "taxonomy.folder": folder }
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
return locations;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
327
|
// src/options.ts
|
|
370
328
|
var DEFAULT_TAXONOMY_TAGS_BASE_PATH = "/tags";
|
|
371
329
|
var DEFAULT_TAXONOMY_FOLDERS_BASE_PATH = "/folders";
|
|
@@ -393,7 +351,6 @@ function resolveTaxonomyOptions(options = {}) {
|
|
|
393
351
|
options.relatedLimit,
|
|
394
352
|
DEFAULT_TAXONOMY_RELATED_LIMIT
|
|
395
353
|
),
|
|
396
|
-
folderIndexes: options.folderIndexes ?? false,
|
|
397
354
|
feeds: {
|
|
398
355
|
rss: options.feeds?.rss ?? true,
|
|
399
356
|
atom: options.feeds?.atom ?? true,
|
|
@@ -527,15 +484,15 @@ function taxonomy(options = {}) {
|
|
|
527
484
|
name: TAXONOMY_PLUGIN_NAME,
|
|
528
485
|
options,
|
|
529
486
|
validateOptions: validateTaxonomyOptions,
|
|
530
|
-
resolveContentLocations: ({ entries, diagnostics }) => resolveFolderIndexLocations(entries, resolved, diagnostics),
|
|
531
487
|
endpoints: createTaxonomyEndpoints(resolved),
|
|
532
488
|
pageTypes: [
|
|
533
489
|
{
|
|
534
490
|
id: "taxonomy-term",
|
|
535
|
-
paths: ({ manifest }) => taxonomyPagePaths(manifest.
|
|
491
|
+
paths: ({ manifest }) => taxonomyPagePaths(manifest.discoverableEntries, resolved),
|
|
492
|
+
outputDependencies: [{ type: "global" }],
|
|
536
493
|
resolve: ({ manifest, pathname }) => {
|
|
537
494
|
const term = findTaxonomyTerm(
|
|
538
|
-
manifest.
|
|
495
|
+
manifest.discoverableEntries,
|
|
539
496
|
resolved,
|
|
540
497
|
pathname
|
|
541
498
|
);
|
|
@@ -554,7 +511,7 @@ function taxonomy(options = {}) {
|
|
|
554
511
|
buildEnd(context) {
|
|
555
512
|
const { config, manifest } = context;
|
|
556
513
|
if (!config) return;
|
|
557
|
-
const index = buildTaxonomyIndex(manifest.
|
|
514
|
+
const index = buildTaxonomyIndex(manifest.discoverableEntries, resolved);
|
|
558
515
|
for (const term of [...index.tags, ...index.folders]) {
|
|
559
516
|
for (const format of enabledFormats(resolved)) {
|
|
560
517
|
const path = feedFilePath(term.path, format);
|
|
@@ -562,7 +519,8 @@ function taxonomy(options = {}) {
|
|
|
562
519
|
emittedFeeds.add(path);
|
|
563
520
|
context.output.emit({
|
|
564
521
|
path,
|
|
565
|
-
content: renderTermFeed(config, term, format, resolved.feedLimit)
|
|
522
|
+
content: renderTermFeed(config, term, format, resolved.feedLimit),
|
|
523
|
+
dependencies: [{ type: "global" }]
|
|
566
524
|
});
|
|
567
525
|
}
|
|
568
526
|
}
|
|
@@ -596,7 +554,7 @@ function createTaxonomyEndpoints(resolved) {
|
|
|
596
554
|
resolved.dataEndpoint,
|
|
597
555
|
({ manifest }) => ({
|
|
598
556
|
json: serializeTaxonomyIndex(
|
|
599
|
-
buildTaxonomyIndex(manifest.
|
|
557
|
+
buildTaxonomyIndex(manifest.discoverableEntries, resolved)
|
|
600
558
|
)
|
|
601
559
|
}),
|
|
602
560
|
{ cacheControl: "public, max-age=300" }
|
|
@@ -640,7 +598,7 @@ function validateTaxonomyOptions(options) {
|
|
|
640
598
|
});
|
|
641
599
|
}
|
|
642
600
|
};
|
|
643
|
-
for (const key of ["tags", "folders", "related"
|
|
601
|
+
for (const key of ["tags", "folders", "related"]) {
|
|
644
602
|
assertBoolean(key);
|
|
645
603
|
}
|
|
646
604
|
for (const key of [
|
|
@@ -695,7 +653,6 @@ export {
|
|
|
695
653
|
renderRelatedTerms,
|
|
696
654
|
renderTaxonomyPage,
|
|
697
655
|
renderTermFeed,
|
|
698
|
-
resolveFolderIndexLocations,
|
|
699
656
|
resolveTaxonomyOptions,
|
|
700
657
|
resolveTaxonomyOptionsFromConfig,
|
|
701
658
|
serializeTaxonomyIndex,
|
package/dist/src/types.d.ts
CHANGED
|
@@ -27,8 +27,6 @@ export type TaxonomyOptions = {
|
|
|
27
27
|
related?: boolean;
|
|
28
28
|
/** Maximum related terms per tag. Defaults to `8`. */
|
|
29
29
|
relatedLimit?: number;
|
|
30
|
-
/** Encode folder index notes (`<folder>/index.md`) as `<folder>`. Defaults to `false`. */
|
|
31
|
-
folderIndexes?: boolean;
|
|
32
30
|
/** Per-format feed generation. Defaults to RSS, Atom, and JSON. */
|
|
33
31
|
feeds?: TaxonomyFeedOptions;
|
|
34
32
|
/** Maximum entries included in a per-term feed. Defaults to `50`. */
|
|
@@ -50,7 +48,6 @@ export type ResolvedTaxonomyOptions = {
|
|
|
50
48
|
minEntries: number;
|
|
51
49
|
related: boolean;
|
|
52
50
|
relatedLimit: number;
|
|
53
|
-
folderIndexes: boolean;
|
|
54
51
|
feeds: Required<TaxonomyFeedOptions>;
|
|
55
52
|
feedLimit: number;
|
|
56
53
|
className: 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.15",
|
|
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.15"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tsx": "^4.22.4"
|
package/dist/src/locations.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ContentLocationInput, type ContentPublicLocation, type Diagnostic } from "@riebeckite/core";
|
|
2
|
-
import type { ResolvedTaxonomyOptions } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Public-location strategy for folder index notes.
|
|
5
|
-
*
|
|
6
|
-
* Core's default resolver collapses only the root `index` slug to `/`. When
|
|
7
|
-
* `folderIndexes` is enabled, a note at `<folder>/index.md` resolves to
|
|
8
|
-
* `/<folder>` instead of `/<folder>/index`, so each folder can own its index
|
|
9
|
-
* page. The chosen permalink is recorded in `metadata["taxonomy.folder"]`.
|
|
10
|
-
*
|
|
11
|
-
* The resolver never overwrites a location that another note already claims as
|
|
12
|
-
* its default permalink; it reports a diagnostic instead.
|
|
13
|
-
*/
|
|
14
|
-
export declare function resolveFolderIndexLocations(entries: readonly ContentLocationInput[], options: ResolvedTaxonomyOptions, diagnostics: Diagnostic[]): ContentPublicLocation[];
|