Skip to content

Commit d52bde3

Browse files
committed
fix: copy lint rule .md files to _site so markdown links resolve
Lint rule pages are generated by lint_rule.page.tsx from source files in lint/rules/, which are excluded from Lume's processing pipeline via site.ignore(). This means the source .md files never made it into _site, causing 125 broken links in the link checker for /lint/rules/*.md URLs. The afterBuild hook now copies lint/rules/*.md directly into _site/lint/rules/ using Deno's file API, bypassing the ignore rules.
1 parent 668859d commit d52bde3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

_config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,24 @@ site.addEventListener("afterBuild", async () => {
190190
/* NOTE: we used to get gfm.css from the jsr.io CDN, but now we simply have a local copy. This is because it needs to be placed on a CSS layer, which isn't possible with an imported file. */
191191
// Deno.writeTextFileSync(site.dest("gfm.css"), GFM_CSS);
192192

193+
// Copy lint rule markdown source files to _site so they're served at /lint/rules/*.md.
194+
// These files are excluded from Lume's processing pipeline (site.ignore) because
195+
// lint_rule.page.tsx handles page generation, but we still want the raw .md accessible.
196+
try {
197+
await Deno.mkdir(site.dest("lint/rules"), { recursive: true });
198+
for await (const entry of Deno.readDir("lint/rules")) {
199+
if (entry.isFile && entry.name.endsWith(".md")) {
200+
await Deno.copyFile(
201+
`lint/rules/${entry.name}`,
202+
site.dest(`lint/rules/${entry.name}`),
203+
);
204+
}
205+
}
206+
log.info("Copied lint rule markdown files to _site/lint/rules/");
207+
} catch (error) {
208+
log.error("Error copying lint rule markdown files: " + error);
209+
}
210+
193211
// Generate LLMs documentation files directly to _site directory
194212
if (Deno.env.get("BUILD_TYPE") == "FULL") {
195213
try {

0 commit comments

Comments
 (0)