ID:WORK-084Status:done
Inject $file.created and $file.modified Variables into Content Pipeline
Priority:highComplexity:moderateMilestone:v1.0.0Source:SPEC-029
Summary
Wire the shared git timestamp utility into packages/content/src/site.ts so that every page's Markdoc transform config includes $file.created and $file.modified variables. These join the existing $page and $frontmatter variables, making file timestamps available to any rune via standard Markdoc variable references.
Acceptance Criteria
loadContent()inpackages/content/src/site.tscalls the git timestamp utility once before the page loop- Each page's
contentVariablesincludes afileobject withcreatedandmodifiedstring properties - Three-tier resolution order: frontmatter override > git history > fs.stat fallback
- When no timestamp is available, the variable is
undefined(not an empty string or null) - Variables are accessible in Markdoc schemas as
$file.createdand$file.modified - Existing
$pageand$frontmattervariables are unaffected - Integration test: a page with no frontmatter dates gets git-derived
$file.createdand$file.modified - Integration test: a page with explicit frontmatter
created/modifieduses those values instead of git data
Approach
- Import the git timestamp utility in
packages/content/src/site.ts - Call it once at the start of
loadContent()with the content root directory - In the per-page loop, look up timestamps for each file path and merge into
contentVariables - Apply the three-tier fallback: check frontmatter first, then git map, then fs.stat
References
- File-Derived Timestamps for Runes (Phase 2 — Variable Injection)
- Create Shared Git Timestamp Utility (shared git timestamp utility — dependency)
packages/content/src/site.ts— existing variable injection point
Relationships
Related
ID:WORK-083Status:done10/10
Create Shared Git Timestamp Utility
Priority:highComplexity:moderateMilestone:v1.0.0
ID:WORK-085Status:done8/8
Add Timestamp Attributes to Plan Rune Schemas
Priority:mediumComplexity:moderateMilestone:v1.0.0
ID:WORK-087Status:done5/5
Add Sitemap lastmod Support Using File Timestamps
Priority:lowComplexity:simpleMilestone:v1.0.0
History
- 59ded4aContent edited
- f262d7bsource+SPEC-029
- f0a845a
- ☑ `loadContent()` in `packages/content/src/site.ts` calls the git timestamp utility once before the page loop
- ☑ Each page's `contentVariables` includes a `file` object with `created` and `modified` string properties
- ☑ Three-tier resolution order: frontmatter override > git history > fs.stat fallback
- +5 more criteria
- f87ae8dstatusready→done
- 2a05e00milestone+v1.0.0
- 43cadfeCreated (ready, high, moderate, content, pipeline, runes)