Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions apps/docs/blume.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { defineConfig } from "blume";
import { vercel } from "blume/analytics";
import { custom, filesystem } from "blume/sources";

import { githubReleaseChangelogSource } from "./sources/github-releases";

Expand All @@ -12,24 +14,21 @@ export default defineConfig({
// label the header would otherwise render beside it (empty string = hidden).
text: "",
},
analytics: {
vercel: true,
},
analytics: [vercel()],
github: {
owner: "thebuilder",
repo: "react-intersection-observer",
dir: "apps/docs",
},
content: {
sources: [
{ type: "filesystem", root: "docs" },
{
type: "custom",
source: githubReleaseChangelogSource({
filesystem({ root: "docs" }),
custom(
githubReleaseChangelogSource({
owner: "thebuilder",
repo: "react-intersection-observer",
}),
},
),
],
},
navigation: {
Expand Down Expand Up @@ -61,10 +60,7 @@ export default defineConfig({
},
},
},
deployment: {
output: "static",
},
ai: {
agents: {
llmsTxt: true,
},
});
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"devDependencies": {
"@biomejs/biome": "^2.5.6",
"blume": "^1.2.1",
"blume": "^2.2.3",
"takumi-js": "^2.5.4"
}
}
73 changes: 43 additions & 30 deletions apps/docs/sources/github-releases.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve } from "node:path";

import type { ContentSource, SourceEntry } from "blume/core/sources/types.ts";
import { githubReleasesSource } from "blume/sources/github-releases.ts";
import { githubReleasesSource } from "blume/core/sources/github-releases.ts";
import type { ContentSource, SourceEntry } from "blume/sources";

type ReleaseSourceOptions = {
owner: string;
Expand All @@ -20,38 +20,51 @@ const excludeFromSearch = (entry: SourceEntry): SourceEntry => ({
raw: entry.raw ? excludeSearchFromRaw(entry.raw) : undefined,
});

/**
* Wrap a release source so its pages stay out of the search index.
*
* `withContext` has to re-wrap rather than pass through: Blume rebuilds a
* `custom()` source on the scan's own cache dir and refresh policy by calling
* it, so a wrapper that inherited the underlying implementation would hand
* back a bare source and silently drop the exclusion.
*/
const withSearchExcluded = (source: ContentSource): ContentSource => ({
...source,
load: async () => {
const result = await source.load();

return {
...result,
entries: result.entries.map(excludeFromSearch),
};
},
read: source.read
? async (ref) => excludeSearchFromRaw(await source.read(ref))
: undefined,
withContext: (next) =>
withSearchExcluded(source.withContext ? source.withContext(next) : source),
});

export const githubReleaseChangelogSource = ({
owner,
repo,
}: ReleaseSourceOptions): ContentSource => {
const isDev = process.argv.includes("dev");
const source = githubReleasesSource(
{
name: "changelog",
owner,
prefix: "changelog",
repo,
},
{
cacheDir: resolve(".blume/cache/changelog"),
mode: isDev ? "dev" : "build",
projectRoot: process.cwd(),
refresh: !isDev,
},
);

return {
...source,
load: async () => {
const result = await source.load();

return {
...result,
entries: result.entries.map(excludeFromSearch),
};
},
read: source.read
? async (ref) => excludeSearchFromRaw(await source.read(ref))
: undefined,
};
return withSearchExcluded(
githubReleasesSource(
{
name: "changelog",
owner,
prefix: "changelog",
repo,
},
{
cacheDir: resolve(".blume/cache/changelog"),
mode: isDev ? "dev" : "build",
projectRoot: process.cwd(),
refresh: !isDev,
},
),
);
};
4 changes: 0 additions & 4 deletions apps/docs/theme.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@media (max-width: 29.999rem) {
[data-blume-header] > .flex.items-center.gap-2 {
display: none;
}

[data-docs-logo] {
flex: none;
}
Expand Down
Loading
Loading