Tegami
Publish package changelogs to a filterable timeline page.
Overview
@fumapress/tegami connects Tegami releases to a Fumapress changelog page.
When you apply a Tegami draft, fumapressPlugin writes MDX release notes into your content directory. changelogPlugin renders those entries on a single index page (/changelog by default) with package filters, date range, search, and load-more pagination.
Installation
npm i @fumapress/tegami tegamiImport the CSS preset:
@import "tailwindcss";
@import "fumadocs-ui/css/neutral.css";
@import "fumadocs-ui/css/preset.css";
@import "fumapress/css/preset.css";
@import "@fumapress/tegami/css/preset.css";Add fumapressPlugin() into your Tegami config:
import { tegami } from "tegami";
import { fumapressPlugin } from "@fumapress/tegami/tegami";
export default tegami({
plugins: [
fumapressPlugin({
dir: "content/changelog",
}),
],
});Fumadocs MDX
Create a changelog collection with the Tegami schemas and enable the plugin:
import { defineConfig } from "fumapress";
import { changelogPlugin } from "@fumapress/tegami";
import { changelogMetaSchema, changelogPageSchema } from "@fumapress/tegami/schema";
import { defineDocs } from "fumadocs-mdx/macro";
const docs = defineDocs({
dir: "content/docs",
docs: { async: true },
});
const changelog = defineDocs({
dir: "content/changelog",
docs: {
async: true,
schema: changelogPageSchema,
lastModified: true,
postprocess: {
includeProcessedMarkdown: true,
},
},
meta: {
schema: changelogMetaSchema,
},
});
export default defineConfig({
content: {
docs: docs.toFumadocsSource(),
changelog: changelog.toFumadocsSource({
baseDir: "changelog",
}),
},
})
.plugins(changelogPlugin());By default, pages from the changelog content source are included. Override with isChangelog() if needed:
import { defineConfig } from "fumapress";
import { changelogPlugin } from "@fumapress/tegami";
export default defineConfig({
// ...
}).plugins(
changelogPlugin({
isChangelog: (page) => page.type === "changelog",
}),
);Other Content Sources
Without Fumadocs MDX, keep your content config and detect changelog pages yourself:
import { defineConfig } from "fumapress";
import { changelogPlugin } from "@fumapress/tegami";
import { myCms } from "./my-cms";
export default defineConfig({
content: myCms.toStaticSource(),
}).plugins(
changelogPlugin({
isChangelog: (page) => page.path.startsWith("changelog/"),
}),
);Options
paths
Override the index pathname (default /changelog). Set to false to skip creating the index route.
import { defineConfig } from "fumapress";
import { changelogPlugin } from "@fumapress/tegami";
export default defineConfig({
// ...
}).plugins(
changelogPlugin({
paths: {
index: "/releases",
},
}),
);layouts
Override the shared layout or index page renderer:
import { defineConfig } from "fumapress";
import {
changelogPlugin,
createChangelogIndexPage,
createChangelogLayout,
} from "@fumapress/tegami";
import { createHomeLayout } from "fumapress/layouts/home";
const HomeLayout = createHomeLayout<typeof config.$context>();
const ChangelogIndex = createChangelogIndexPage<typeof config.$context>({
heading: "Releases",
description: "What shipped recently.",
pageSize: 10,
});
const config = defineConfig({
// ...
}).plugins(
changelogPlugin({
layouts: {
layout: (props) => <HomeLayout {...props} />,
index: (props) => <ChangelogIndex {...props} />,
},
}),
);
export default config;Last updated on
