Color mode

Archive

日本語

Monthly archive listing pages for Riebeckite. The plugin builds its listings with the Core collection engine (buildContentCollections), so links, ordering, and pagination reuse the same query pipeline as the rest of the site.

Installation

bash
pnpm add @riebeckite/plugin-archive

Usage

ts
import { archive } from "@riebeckite/plugin-archive";
 
export default {
  plugins: [archive()],
};

Page types

The plugin registers a single Page Type, archive, and only while the plugin is enabled. Routes are generated by the plugin, not by application code.

  • archive: one listing page per month at <basePath>/<yyyy>/<mm>, with additional pages at <basePath>/<yyyy>/<mm>/page/<n> when pagination applies.

Entries are grouped by the first available date among published, date, and created, at month granularity. Months are ordered newest first, and every link uses the entry's resolved permalink.

Publication and localization

Listings are built from manifest.discoverableEntries, so unlisted, draft, and scheduled notes never appear. The period title and the previous/next pagination labels follow site.locale; set locale on the plugin to override it. Japanese and English labels are provided, and the period is formatted through Intl.DateTimeFormat for any locale.

Options

Option Type Default Description
basePath string "/archive" Path prefix for the generated pages. An empty string disables them.
pageSize number 10 Entries per page. 0 keeps a single page.
locale string site.locale Locale used for the period and pagination labels.
className string "rb-archive" Root CSS class for the rendered fragment.

Exports

  • archive / archivePlugin — the plugin factory.
  • resolveArchiveOptions — resolves options with defaults.
  • buildArchiveCollections — builds the monthly collections for entries.
  • archiveDefinitions — the Core collection definitions used by the plugin.
  • renderArchivePage — renders one archive listing page to HTML.
  • formatArchivePeriod, archivePaginationLabels — locale helpers.
  • DEFAULT_ARCHIVE_BASE_PATH, DEFAULT_ARCHIVE_PAGE_SIZE, DEFAULT_ARCHIVE_CLASS_NAME, ARCHIVE_COLLECTION_KIND.

Notes

The plugin ships no stylesheet; the rendered fragment carries rb-archive classes so a site can style it directly. Set basePath to a different prefix if /archive clashes with existing content, and set it to "" to turn the generated pages off without removing the plugin.

History

1 changesCollapseExpand
1 + <!-- Generated from packages/plugins/archive/README.md. Do not edit this page directly; edit the package README and run `pnpm docs:sync`. -->
2 +
3 + # Archive
4 +
5 + [日本語](./archive.md)
6 +
7 + Monthly archive listing pages for Riebeckite. The plugin builds its listings with
8 + the Core collection engine (`buildContentCollections`), so links, ordering, and
9 + pagination reuse the same query pipeline as the rest of the site.
10 +
11 + ## Installation
12 +
13 + ```bash
14 + pnpm add @riebeckite/plugin-archive
15 + ```
16 +
17 + ## Usage
18 +
19 + ```ts
20 + import { archive } from "@riebeckite/plugin-archive";
21 +
22 + export default {
23 + plugins: [archive()],
24 + };
25 + ```
26 +
27 + ## Page types
28 +
29 + The plugin registers a single Page Type, `archive`, and only while the plugin is
30 + enabled. Routes are generated by the plugin, not by application code.
31 +
32 + - `archive`: one listing page per month at `<basePath>/<yyyy>/<mm>`, with
33 + additional pages at `<basePath>/<yyyy>/<mm>/page/<n>` when pagination applies.
34 +
35 + Entries are grouped by the first available date among `published`, `date`, and
36 + `created`, at month granularity. Months are ordered newest first, and every link
37 + uses the entry's resolved permalink.
38 +
39 + ## Publication and localization
40 +
41 + Listings are built from `manifest.discoverableEntries`, so unlisted, draft, and
42 + scheduled notes never appear. The period title and the previous/next pagination
43 + labels follow `site.locale`; set `locale` on the plugin to override it. Japanese
44 + and English labels are provided, and the period is formatted through
45 + `Intl.DateTimeFormat` for any locale.
46 +
47 + ## Options
48 +
49 + | Option | Type | Default | Description |
50 + | --- | --- | --- | --- |
51 + | `basePath` | `string` | `"/archive"` | Path prefix for the generated pages. An empty string disables them. |
52 + | `pageSize` | `number` | `10` | Entries per page. `0` keeps a single page. |
53 + | `locale` | `string` | `site.locale` | Locale used for the period and pagination labels. |
54 + | `className` | `string` | `"rb-archive"` | Root CSS class for the rendered fragment. |
55 +
56 + ## Exports
57 +
58 + - `archive` / `archivePlugin` — the plugin factory.
59 + - `resolveArchiveOptions` — resolves options with defaults.
60 + - `buildArchiveCollections` — builds the monthly collections for entries.
61 + - `archiveDefinitions` — the Core collection definitions used by the plugin.
62 + - `renderArchivePage` — renders one archive listing page to HTML.
63 + - `formatArchivePeriod`, `archivePaginationLabels` — locale helpers.
64 + - `DEFAULT_ARCHIVE_BASE_PATH`, `DEFAULT_ARCHIVE_PAGE_SIZE`,
65 + `DEFAULT_ARCHIVE_CLASS_NAME`, `ARCHIVE_COLLECTION_KIND`.
66 +
67 + ## Notes
68 +
69 + The plugin ships no stylesheet; the rendered fragment carries `rb-archive`
70 + classes so a site can style it directly. Set `basePath` to a different prefix if
71 + `/archive` clashes with existing content, and set it to `""` to turn the
72 + generated pages off without removing the plugin.
73 +