Repository navigation
Commit ef18bda
authored
* feat(seo): make sitemap and RSS generation deterministic (#189)
- Rewrite scripts/sitemap.ts as the single entrypoint for both the
build pipeline and pnpm generate:sitemap. scripts/gen-sitemap.mjs
is retired; all callers now go through tsx scripts/sitemap.ts.
- Derive per-route lastmod from trustworthy sources only:
• blog posts → date frontmatter in the MDX file
• case studies → integrationDate field in case-studies.json
• static pages → git log date of the page's source file(s)
• tag archives / author pages → omitted entirely (no single date)
Running the generator twice on unchanged content now produces
byte-identical output.
- Fix RSS lastBuildDate: use the publication date of the most-recent
post instead of new Date().toISOString(), so feed.xml is stable
across builds when no post has been added or changed.
- Add --check mode to scripts/sitemap.ts: exits 1 when
public/sitemap.xml is stale. Hook it into the CI build job via
pnpm check:sitemap so a stale file fails the pull request.
- Add pnpm generate:sitemap and pnpm check:sitemap scripts to
package.json.
- Add src/__tests__/sitemap.test.ts covering lastmod omission,
deterministic output, and correct root URL rendering.
- Extend src/__tests__/rss.test.ts with two new cases: lastBuildDate
derived from the newest post, and byte-identical output across calls.
- Regenerate public/sitemap.xml and public/feed.xml (+ tag feeds)
with the new deterministic logic.
- Update README.md to document the new scripts and check mode.
* fix(test): correct day-of-week in lastBuildDate assertion and apply prettier
* fix(ci): fetch full history for sitemap determinism and regenerate sitemap
actions/checkout@v4 defaults to fetch-depth: 1 (shallow clone), which
means git log -1 -- <path> in gitLastModified() either returns empty or
resolves to the synthetic PR merge commit. check:sitemap then regenerates
different XML and the build job fails as stale.
Add fetch-depth: 0 to the unit-tests and build job checkouts so every
git log call in scripts/sitemap.ts sees the real commit history.
Regenerate public/sitemap.xml against the full local history so the
committed file matches what CI will produce after this fix.
* fix(sitemap): prevent command injection via crafted filenames in gitLastModified (#189)
* fix(deps): bump toml override to 5.0.1 to resolve high-severity advisories
* fix(test): drain preview request stream and handle socket reset in chunked body test
1 parent cc48495 commit ef18bda
21 files changed
Lines changed: 865 additions & 194 deletions
File tree
- .github/workflows
- public
- feed/tag
- scripts
- src/__tests__
- tests
- smoke
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
29 | 47 | | |
30 | 48 | | |
31 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
0 commit comments