Skip to content

Commit 2fed5bc

Browse files
bartlomiejuclaude
andauthored
fix: store last-modified dates in frontmatter (#3002)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 08bef37 commit 2fed5bc

220 files changed

Lines changed: 222 additions & 25 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

_config.ts

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -455,33 +455,11 @@ site.ignore(
455455
// the default layout if no other layout is specified
456456
site.data("layout", "doc.tsx");
457457

458-
// Populate lastModified from git history using a single git command
458+
// Populate lastModified from frontmatter `last_modified` field
459459
site.preprocess([".md", ".mdx"], (filteredPages) => {
460-
const result = Deno.spawnAndWaitSync("git", [
461-
"log",
462-
"--pretty=format:%aI",
463-
"--name-only",
464-
"--diff-filter=ACMR",
465-
"HEAD",
466-
]);
467-
468-
const output = new TextDecoder().decode(result.stdout);
469-
const lastModified = new Map<string, string>();
470-
let currentDate = "";
471-
472-
for (const line of output.split("\n")) {
473-
if (!line) continue;
474-
if (line.match(/^\d{4}-/)) {
475-
currentDate = line;
476-
} else if (!lastModified.has(line)) {
477-
lastModified.set(line, currentDate);
478-
}
479-
}
480-
481460
for (const page of filteredPages) {
482-
const src = page.sourcePath?.replace(/^\//, "");
483-
if (src && lastModified.has(src)) {
484-
page.data.lastModified = new Date(lastModified.get(src)!);
461+
if (page.data.last_modified) {
462+
page.data.lastModified = new Date(page.data.last_modified);
485463
}
486464
}
487465
});

deploy/acceptable_use_policy.md

Lines changed: 1 addition & 0 deletions

deploy/changelog.md

Lines changed: 1 addition & 0 deletions

deploy/classic/api/compression.md

Lines changed: 1 addition & 0 deletions

deploy/classic/api/dynamic-import.md

Lines changed: 1 addition & 0 deletions

deploy/classic/api/index.md

Lines changed: 1 addition & 0 deletions

deploy/classic/api/runtime-broadcast-channel.md

Lines changed: 1 addition & 0 deletions

deploy/classic/api/runtime-fetch.md

Lines changed: 1 addition & 0 deletions

deploy/classic/api/runtime-fs.md

Lines changed: 1 addition & 0 deletions

deploy/classic/api/runtime-headers.md

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)