# Changelog

A changelog from Markdown or GitHub Releases.

`@vuesho/changelog` serves a page of release notes at `/changelog`, newest first, with filters by package, date and text. The notes can be Markdown pages, the pages that [Tegami](https://tegami.fuma-nama.dev) writes for each release, or a repository's [GitHub releases](#github-releases).

## Setup [#setup]

### Install the Package [#install-the-package-step]

```npm
npm i @vuesho/changelog
```

### Add the Notes [#add-the-notes-step]

Put the notes in a separate folder, like `content/changelog`:

```files
content
├── index.md
└── changelog
    └── 2026-11-20-sidebar.md
```

A [collection](/markdown/collections) reads the folder as a separate source, and `changelogPlugin()` takes the source's key. The notes need their own `baseDir`, since two sources can't both serve pages at the site root:

```ts title="vuesho.config.ts"
import { changelogPlugin } from "@vuesho/changelog";
import { createSite, recommendedPreset } from "vuesho/config";
import { defineCollections, defineDocs } from "vuesho/content";

const docs = defineDocs();
const changelog = defineCollections({ type: "doc", dir: "content/changelog" });

export default createSite({
  docs: docs.toSource(),
  changelog: changelog.toSource({ baseDir: "changelog" }), // [!code highlight]
}).plugins(recommendedPreset(), changelogPlugin({ source: "changelog" }));
```

### Hide the Notes From the Sidebar [#hide-the-notes-from-the-sidebar-step]

`!changelog` in the root [meta file](/navigation) hides the notes from the sidebar, but keeps their pages:

```json title="content/meta.json"
{
  "pages": ["...", "!changelog"]
}
```

### Write a Note [#write-a-note-step]

A note sets the release `date`, and each released package's version in `packages`:

<Tabs :items='["By hand","With Tegami"]'>
<Tab value="By hand">
```md title="content/changelog/2026-11-20-sidebar.md"
---
title: Fix the hover state of the sidebar
date: 2026-11-20
packages:
  vuesho:
    version: 1.0.1
---

The hover color now matches the theme.
```
</Tab>

<Tab value="With Tegami">
`changelogPages()` writes a note for each changelog entry when Tegami bumps the versions. `dir` is relative to the repository root:

```ts title="scripts/tegami.ts"
import { tegami } from "tegami";
import { runCli } from "tegami/cli";
import { changelogPages } from "@vuesho/changelog/tegami";

const paper = tegami({
  plugins: [changelogPages({ dir: "content/changelog" })], // [!code highlight]
});

await runCli(paper);
```
</Tab>
</Tabs>

Open `/changelog` to see the notes. Each note also has a page, like `/changelog/2026-11-20-sidebar`.

## Configuring the Changelog [#configuring-the-changelog]

`changelogPlugin()` adds a typed `packages` field to the notes' frontmatter, and a wrong shape fails the build. A note without a `date` shows first.

<Callout title="Frontmatter Schemas">
If your collection has a [frontmatter schema](/markdown/collections#frontmatter-schema), leave `packages` out of it, since the plugin declares the field.
</Callout>

The notes can come from any [content source](/content-sources), or from several. A note's date comes from the [`getPageCreatedAt` hook](/content-hooks), and its versions from the `packages` field in its data:

```ts title="vuesho.config.ts"
changelogPlugin({ source: ["changelog", "releases"] });
```

`paths.index` changes the page's URL, and `false` removes the page:

```ts title="vuesho.config.ts"
changelogPlugin({
  source: "changelog",
  paths: { index: "/releases" }, // [!code highlight]
});
```

With [Internationalization](/i18n), each language has a changelog page, like `/cn/changelog`. When the notes come from a [dynamic source](/dynamic-rendering), the page renders on request.

## Customizing the UI [#customizing-the-ui]

The page is the view `changelog.index`, which your [theme](/theme#views-and-page-bodies) can replace:

```ts title="src/theme.ts"
import { defineTheme } from "vuesho/theme";
import defaultTheme from "vuesho/theme/default";
import type app from "../vuesho.config";

export default defineTheme<typeof app>({
  extends: defaultTheme,
  views: { "changelog.index": () => import("./Changelog.vue") }, // [!code highlight]
});
```

The view receives the notes in `page.props.entries`, and `page.contentOf` holds each note's body under its entry's `id`. `ChangelogIndexView` from `@vuesho/changelog/ui` renders the built-in page:

```vue title="src/Changelog.vue"
<script setup lang="ts">
import { ChangelogIndexView } from "@vuesho/changelog/ui";
import type { PageOf } from "vuesho/client";
import { HomeShell } from "vuesho/theme";
import type app from "../vuesho.config";

defineProps<{ page: PageOf<typeof app, "changelog.index"> }>();
</script>

<template>
  <HomeShell>
    <ChangelogIndexView :entries="page.props.entries" :page-size="20">
      <template #heading>Releases</template>
      <template #description>What changed in each version.</template>
      <template #body="{ entry }">
        <component :is="page.contentOf[entry.id]" v-if="page.contentOf[entry.id]" />
      </template>
    </ChangelogIndexView>
  </HomeShell>
</template>
```

To edit the components themselves, copy them into your project with [`vuesho add`](/cli#vuesho-add):

```npm
npx vuesho add components/layouts --from @vuesho/changelog
```

## GitHub Releases [#github-releases]

`fetchGitHubReleases()` fetches one page of a GitHub repository's published releases, for a [custom page](/custom-pages) rendered on request, which needs a [server](/deploying#server-hosting). It reads versions like `vuesho@1.0.0` from each release's name or tag. The notes render as Markdown with GFM, and their HTML shows as text.

### Add the Stylesheet [#add-the-stylesheet-step]

Without `changelogPlugin()`, the site doesn't load the components' stylesheet, so add it with a plugin in your config:

```ts title="vuesho.config.ts"
createSite(docs.toSource()).plugins(
  recommendedPreset(),
  // [!code ++:4]
  {
    name: "site:changelog",
    stylesheet: "@vuesho/changelog/css/changelog.css",
  },
);
```

### Render the Releases [#render-the-releases-step]

`ChangelogTimeline` shows the releases grouped by month, and `ChangelogPagination` links to the newer and older pages:

```vue title="src/pages/changelog/[...page].vue"
<script setup lang="ts">
import { fetchGitHubReleases, type ChangelogEntry } from "@vuesho/changelog";
import { ChangelogPagination, ChangelogTimeline } from "@vuesho/changelog/ui";
import { definePage } from "vuesho/client";
import { HomeShell } from "vuesho/theme";

definePage({
  data: { title: "Changelog" },
  props: async ({ params }) => {
    // `[...page]` also matches `/changelog`, as page 1.
    const page = Number(params.page.join("/") || 1);
    if (!Number.isInteger(page) || page < 1) return;
    const { entries, nextPage } = await fetchGitHubReleases({
      owner: "acme",
      repo: "acme",
      token: process.env.GITHUB_TOKEN,
      page,
    });
    if (entries.length === 0) return;
    return {
      entries,
      newer: page > 1 ? `/changelog/${page - 1}` : undefined,
      older: nextPage ? `/changelog/${nextPage}` : undefined,
    };
  },
});

defineProps<{ entries: ChangelogEntry[]; newer?: string; older?: string }>();
</script>

<template>
  <HomeShell>
    <div class="mx-auto flex w-full max-w-[900px] flex-col gap-8">
      <ChangelogTimeline :entries="entries" />
      <ChangelogPagination :newer="newer" :older="older" />
    </div>
  </HomeShell>
</template>
```

<Callout title="Rate Limits">
GitHub allows 60 requests an hour without a `token`. To reuse the releases between requests, add a `cache` route rule.
</Callout>

### Releases From Other APIs [#releases-from-other-apis]

`ChangelogTimeline` and `ChangelogIndexView` take entries from any API. To show an entry's notes, set their Markdown as the entry's `content`.

The timeline's `body` slot receives `{ entry }` and renders instead of `content`:

### ChangelogEntry

| Prop           | Type                                                | Description                                                                                                                                                |
| -------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`           | `string`                                            | A unique ID, like a release tag or a page URL.                                                                                                             |
| `title`        | `string`                                            | The title, which the timeline shows as the entry's heading.                                                                                                |
| `description?` | `string \| undefined`                               | A summary, which the changelog page's search reads.                                                                                                        |
| `date`         | `string`                                            | The release date, as an ISO date.                                                                                                                          |
| `versions?`    | `{ name: string; version: string; }[] \| undefined` | The released packages, like `vuesho` at `1.0.0`.                                                                                                           |
| `url?`         | `string \| undefined`                               | The entry's URL, like its page or its GitHub release.                                                                                                      |
| `content?`     | `string \| undefined`                               | The content in Markdown, like the notes of a GitHub release. The timeline renders it with GFM, and HTML as text, unless its `body` slot renders the entry. |

## Options [#options]

### `changelogPlugin()` [#changelogplugin]

### ChangelogPluginOptions

| Prop     | Type                                        | Description                                      |
| -------- | ------------------------------------------- | ------------------------------------------------ |
| `source` | `string \| readonly string[]`               | The source keys that hold the changelog's pages. |
| `paths?` | `{ index?: string \| false; } \| undefined` | The paths of the changelog's pages.              |

### `fetchGitHubReleases()` [#fetchgithubreleases]

### GitHubReleasesOptions

| Prop       | Type                  | Description                                                             |
| ---------- | --------------------- | ----------------------------------------------------------------------- |
| `owner`    | `string`              | The repository's owner, a user or an organization.                      |
| `repo`     | `string`              | The repository's name.                                                  |
| `token?`   | `string \| undefined` | A GitHub access token. Without one, GitHub allows 60 requests per hour. |
| `page?`    | `number \| undefined` | The page of releases, from 1. Default: `1`                              |
| `perPage?` | `number \| undefined` | Releases per page, up to 100. Default: `30`                             |
| `baseUrl?` | `string \| undefined` | The GitHub API's base URL. Default: `"https://api.github.com"`          |
