feat: add content collection with schema and reading-time utility
- Created src/content.config.ts with Astro defineCollection using glob loader, pattern '**/*.{md,mdx}', base './src/content/posts', and Zod schema with 5 fields (title, date, type, tags, summary)
- Created src/content/posts/ directory for content storage
- Created src/utils/reading-time.ts with getReadingTime function (split whitespace, 200 WPM, Math.max(1, Math.ceil))
- All 23 new tests pass, all 61 total tests pass, npm run build succeeds
Generated with Amplifier
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
export function getReadingTime(text: string): number {
|
||||
const words = text.split(/\s+/).filter(Boolean);
|
||||
return Math.max(1, Math.ceil(words.length / 200));
|
||||
}
|
||||
Reference in New Issue
Block a user