Skip to content

Commit 5e2d50d

Browse files
martrappCopilot
andcommitted
Remove updateThreshold from content schema and API documentation
Co-authored-by: Copilot <copilot@github.com>
1 parent d21db86 commit 5e2d50d

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/components/LastUpdated.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { spawnSync } from "child_process";
33
import { basename, dirname } from "path";
44
55
let { lang, lastUpdated } = Astro.locals.starlightRoute;
6-
const threshold = Astro.locals.starlightRoute.entry?.data?.updateThreshold;
76
const published = (f: string) =>
87
spawnSync(
98
"git",
@@ -22,7 +21,7 @@ const published = (f: string) =>
2221
).stdout?.trim();
2322
2423
const updated = (f: string) => {
25-
const cmd = `git log --follow --numstat --format=%ct ${basename(f)} |paste -d' ' - - - | awk '$2 - $3 > ${threshold} {print $1; exit}'`;
24+
const cmd = `git log --follow --format=%ct ${basename(f)} | head -n 1`;
2625
const res = spawnSync("bash", ["-c", cmd], {
2726
cwd: dirname(f),
2827
encoding: "utf-8",
@@ -32,7 +31,8 @@ const updated = (f: string) => {
3231
const firstPublished = new Date(
3332
Number(published(Astro.locals.starlightRoute.entry.filePath) + "000")
3433
);
35-
lastUpdated = new Date(
34+
// use starlights value
35+
lastUpdated ||= new Date(
3636
Number(updated(Astro.locals.starlightRoute.entry.filePath) + "000")
3737
);
3838

src/content.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const collections = {
99
schema: docsSchema({
1010
extend: z.object({
1111
renderBlocking: z.string().optional(),
12-
updateThreshold: z.number().optional().default(20),
1312
}),
1413
})
1514
}),

src/content/docs/basics/api.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: The View Transition API
33
description: Basics information about the View Transition browser API
4-
updateThreshold: 0
54
head:
65
- tag: meta
76
attrs:

0 commit comments

Comments
 (0)