@riebeckite/plugin-taxonomy 0.0.14 → 0.0.16

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 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 |
@@ -106,6 +104,8 @@ Folder terms get the same files under `/folders/<path>/…`. Feed channels carry
106
104
  their own term title and self link, so a tag subscription is distinguishable
107
105
  from the site-wide feeds owned by `@riebeckite/plugin-seo`. Only published,
108
106
  non-`noindex` entries reach the manifest's public view and therefore the feeds.
107
+ RSS and Atom term feeds expose entry summaries. JSON term feeds use the same
108
+ summary as `content_text` and do not duplicate rendered article HTML.
109
109
 
110
110
  ## Related tags
111
111
 
@@ -133,11 +133,11 @@ provider is registered.
133
133
 
134
134
  ## Folder index notes
135
135
 
136
- With `folderIndexes: true`, the plugin's `resolveContentLocations` hook maps a
137
- note at `<folder>/index.md` to `/<folder>` instead of `/<folder>/index`. The
138
- chosen permalink is recorded as `metadata["taxonomy.folder"]`. A location is
139
- never claimed when another note already owns it; the conflict is reported as a
140
- diagnostic instead.
136
+ Folder entry resolution is owned by
137
+ [`@riebeckite/plugin-folder-pages`](../folder-pages/README.md), so taxonomy only
138
+ generates tag and folder terms from the manifest's public view. Enable that
139
+ plugin when a note at `<folder>/README.md` or `<folder>/index.md` should become
140
+ the folder's landing page.
141
141
 
142
142
  ## Page types
143
143
 
@@ -171,7 +171,6 @@ import "@riebeckite/plugin-taxonomy/style.css";
171
171
  - `renderTaxonomyPage(term, options)` / `renderRelatedTerms(term, options)` — page fragments
172
172
  - `renderTermFeed(config, term, format, limit?)` / `buildFeedHeadTags(term)` — per-term feeds
173
173
  - `buildTaxonomySeo(config, term)` — listing-page SEO metadata
174
- - `resolveFolderIndexLocations(entries, options, diagnostics)` — folder-index location strategy
175
174
  - `slugifyTaxonomyValue(value)` — URL/file slug
176
175
  - `buildTaxonomyAbsoluteUrl(config, pathOrUrl)` — absolute URLs
177
176
  - Types: `TaxonomyOptions`, `ResolvedTaxonomyOptions`, `TaxonomyTerm`, `TaxonomyIndex`, `TaxonomyPage`, `TaxonomyTermData`, `TaxonomyIndexData`
@@ -186,5 +185,5 @@ import "@riebeckite/plugin-taxonomy/style.css";
186
185
 
187
186
  ## See also
188
187
 
189
- - [Plugin guide](../../../docs/en/reference/plugin-api.md)
190
- - [Content system](../../../docs/en/framework/content-system.md)
188
+ - [Plugin guide](../../../docs/en/docs/reference/plugin-api.md)
189
+ - [Content system](../../../docs/en/docs/framework/content-system.md)
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` / パス | 語の表示タイトル |
@@ -106,6 +104,8 @@ GET /taxonomy/index.json
106
104
  語ごとのタイトルと self link を持つため、タグの購読と
107
105
  `@riebeckite/plugin-seo` が持つサイト全体のフィードを区別できます。公開かつ
108
106
  `noindex` でないエントリだけがマニフェストの公開ビューに入り、フィードへ届きます。
107
+ 語ごとの RSS と Atom はエントリの要約を出します。語ごとの JSON Feed は同じ要約を
108
+ `content_text` として出し、描画済みの記事 HTML は複製しません。
109
109
 
110
110
  ## 関連タグ
111
111
 
@@ -132,10 +132,11 @@ Core `seo` 拡張ポイント(たとえば `@riebeckite/plugin-seo`)へ委
132
132
 
133
133
  ## フォルダ index note
134
134
 
135
- `folderIndexes: true` のとき、プラグインの `resolveContentLocations` フックが
136
- `<folder>/index.md` のノートを `/<folder>/index` ではなく `/<folder>` に解決します。
137
- 選ばれた permalink は `metadata["taxonomy.folder"]` に記録されます。すでに他の
138
- ノートが所有している location は決して奪わず、衝突は診断として報告します。
135
+ フォルダ入口の解決は
136
+ [`@riebeckite/plugin-folder-pages`](../folder-pages/README_ja.md) が所有します。
137
+ taxonomy はマニフェストの公開ビューからタグ語とフォルダ語だけを生成します。
138
+ `<folder>/README.md` や `<folder>/index.md` をフォルダのランディングページに
139
+ する場合は、そのプラグインを有効にしてください。
139
140
 
140
141
  ## Page Type
141
142
 
@@ -169,7 +170,6 @@ import "@riebeckite/plugin-taxonomy/style.css";
169
170
  - `renderTaxonomyPage(term, options)` / `renderRelatedTerms(term, options)` — ページ断片
170
171
  - `renderTermFeed(config, term, format, limit?)` / `buildFeedHeadTags(term)` — 語ごとのフィード
171
172
  - `buildTaxonomySeo(config, term)` — 一覧ページの SEO メタデータ
172
- - `resolveFolderIndexLocations(entries, options, diagnostics)` — フォルダ index の location 戦略
173
173
  - `slugifyTaxonomyValue(value)` — URL・ファイル用の slug
174
174
  - `buildTaxonomyAbsoluteUrl(config, pathOrUrl)` — 絶対 URL
175
175
  - 型: `TaxonomyOptions`, `ResolvedTaxonomyOptions`, `TaxonomyTerm`, `TaxonomyIndex`, `TaxonomyPage`, `TaxonomyTermData`, `TaxonomyIndexData`
@@ -185,5 +185,5 @@ import "@riebeckite/plugin-taxonomy/style.css";
185
185
 
186
186
  ## 関連
187
187
 
188
- - [プラグインガイド](../../../docs/ja/reference/plugin-api.md)
189
- - [コンテンツシステム](../../../docs/ja/framework/content-system.md)
188
+ - [プラグインガイド](../../../docs/ja/docs/reference/plugin-api.md)
189
+ - [コンテンツシステム](../../../docs/ja/docs/framework/content-system.md)
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
@@ -285,7 +285,7 @@ function renderJson(config, term, entries, title) {
285
285
  id: url,
286
286
  url,
287
287
  title: entry.title,
288
- content_html: entry.html,
288
+ content_text: getDescription(entry),
289
289
  summary: getDescription(entry),
290
290
  date_published: getPublishedTime(entry) ?? void 0,
291
291
  date_modified: getUpdatedTime(entry) ?? void 0,
@@ -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.publicEntries, resolved),
491
+ paths: ({ manifest }) => taxonomyPagePaths(manifest.discoverableEntries, resolved),
492
+ outputDependencies: [{ type: "global" }],
536
493
  resolve: ({ manifest, pathname }) => {
537
494
  const term = findTaxonomyTerm(
538
- manifest.publicEntries,
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.publicEntries, resolved);
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.publicEntries, resolved)
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", "folderIndexes"]) {
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,
@@ -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.14",
3
+ "version": "0.0.16",
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.14"
18
+ "@riebeckite/core": "0.0.16"
19
19
  },
20
20
  "devDependencies": {
21
21
  "tsx": "^4.22.4"
package/style.css CHANGED
@@ -99,9 +99,3 @@
99
99
  border-color: var(--rr-taxonomy-accent);
100
100
  color: var(--rr-taxonomy-accent);
101
101
  }
102
-
103
- html[data-theme="dark"] .rr-taxonomy,
104
- html.dark .rr-taxonomy {
105
- --rr-taxonomy-ink: var(--rb-color-paper, #ffffff);
106
- --rr-taxonomy-muted: var(--rb-color-muted, #a8a29a);
107
- }
@@ -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[];