feat(config): add repo link and actions to docs navigation

This commit is contained in:
Prad Nukala committed 2026-09-30 17:33:35 -04:00
1 parent 239c7013f8
commit 31054c01a7
1 file changed
+17 -8
+17 -8
View File
@@ -1,7 +1,7 @@
import { defineConfig } from "blume"; import { defineConfig } from "blume";
import type { StandardSchema } from "blume/core/standard-schema.ts";
import { hashText } from "blume/core/sources/cache.ts"; import { hashText } from "blume/core/sources/cache.ts";
import type { ContentSource } from "blume/core/sources/types.ts"; import type { ContentSource } from "blume/core/sources/types.ts";
import type { StandardSchema } from "blume/core/standard-schema.ts";
import { custom, filesystem } from "blume/sources"; import { custom, filesystem } from "blume/sources";
import { githubReleasesSource } from "blume/sources/github-releases.ts"; import { githubReleasesSource } from "blume/sources/github-releases.ts";
import redirects from "./redirects"; import redirects from "./redirects";
@@ -59,9 +59,18 @@ const releasesByKind = (source: ContentSource): ContentSource => ({
load: async () => { load: async () => {
const result = await source.load(); const result = await source.load();
for (const entry of result.entries) { for (const entry of result.entries) {
const kind = typeof entry.data.title === "string" ? entry.data.title.match(RELEASE_KIND)?.[1] : undefined; const kind =
typeof entry.data.title === "string"
? entry.data.title.match(RELEASE_KIND)?.[1]
: undefined;
const changelog = entry.data.changelog; const changelog = entry.data.changelog;
if (!kind || !changelog || typeof changelog !== "object" || !("category" in changelog)) continue; if (
!kind ||
!changelog ||
typeof changelog !== "object" ||
!("category" in changelog)
)
continue;
changelog.category = kind; changelog.category = kind;
if (entry.raw) { if (entry.raw) {
entry.raw = entry.raw.replace(/^( {2}category: ).*$/m, `$1${kind}`); entry.raw = entry.raw.replace(/^( {2}category: ).*$/m, `$1${kind}`);
@@ -70,7 +79,8 @@ const releasesByKind = (source: ContentSource): ContentSource => ({
} }
return result; return result;
}, },
withContext: source.withContext && ((ctx) => releasesByKind(source.withContext!(ctx))), withContext:
source.withContext && ((ctx) => releasesByKind(source.withContext!(ctx))),
}); });
// Blume's defaults (`inter`, `ibm-plex-mono`) are fetched from fonts.gstatic.com // Blume's defaults (`inter`, `ibm-plex-mono`) are fetched from fonts.gstatic.com
@@ -211,12 +221,11 @@ export default defineConfig({
fonts: { display: inter, body: inter, mono: plexMono }, fonts: { display: inter, body: inter, mono: plexMono },
}, },
navigation: { navigation: {
repo: "https://github.com/prdlk/leetcode",
actions: [{ href: "/changelog", label: "Changelog" }],
sidebar: { sidebar: {
display: "flat", // "flat" | "group" | "page" display: "flat", // "flat" | "group" | "page"
}, },
tabs: [ tabs: [{ label: "Guides", path: "/guides" }],
{ label: "Guides", path: "/guides" },
{ label: "Changelog", path: "/changelog" },
],
}, },
}); });