feat: add markdown content pipeline with build script

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 13:26:33 +08:00
parent 5f8d686290
commit 1ed7fad293
9 changed files with 1164 additions and 4 deletions

33
src/lib/content.ts Normal file
View File

@@ -0,0 +1,33 @@
import type { Language } from './translations';
export interface ContentMeta {
slug: string;
title: string;
description: string;
date: string;
tags: string[];
order?: number;
cover?: string;
}
export interface ContentManifest {
en: ContentMeta[];
zh: ContentMeta[];
}
export interface ContentItem {
meta: ContentMeta;
html: string;
}
const BASE = '/content';
export async function loadManifest(type: 'docs' | 'blog'): Promise<ContentManifest> {
const res = await fetch(`${BASE}/${type}-manifest.json`);
return res.json();
}
export async function loadContent(type: 'docs' | 'blog', lang: Language, slug: string): Promise<ContentItem> {
const res = await fetch(`${BASE}/${type}/${lang}/${slug}.json`);
return res.json();
}