Scribeنظام إدارة محتوى MDX مُنمَّط

أمثلة

مقتطفات جاهزة للنسخ لسير عمل scribe-cms الشائعة.

التثبيت

أضف scribe-cms إلى أي مشروع Node 20+.

pnpm add scribe-cms zod better-sqlite3

الإعدادات

حدّد أنواع المحتوى باستخدام Zod — حقول قابلة للترجمة، وهيكلية، وعلائقية.

import { z } from "zod";
import { defineConfig, defineContentType, field } from "scribe-cms";

const blogSchema = z.object({
title: field.translatable(z.string().min(1)),
description: field.translatable(z.string().min(50)),
author: field.relation("author"),
});

const authorSchema = z.object({
name: field.structural(z.string().min(1)),
});

export default defineConfig({
  rootDir: ".",
  locales: ["en", "fr"],
  types: [
    defineContentType({
      id: "blog",
      path: "/blog/{slug}",
      schema: blogSchema,
      slugStrategy: "localized",
    }),
    defineContentType({
      id: "author",
      contentDir: "authors",
      schema: authorSchema,
    }),
  ],
});

ملف المحتوى

ملف .mdx واحد لكل مستند — اسم الملف هو المعرف (slug) باللغة الإنجليزية.

---
title: "مرحباً بالعالم"
description: "منشور أولي يلقي التحية على العالم بإسهاب، لأن المخطط يتطلب خمسين حرفاً على الأقل."
author: jane
publishedAt: "2026-01-15"
---

المحتوى الأساسي مكتوب بصيغة MDX. كل من **Markdown** والمكونات تعمل بشكل مثالي.

بيئة التشغيل

قراءة المحتوى باستخدام عميل مُعرّف الأنواع — عرض القوائم، والتحليل، وتتبع العلاقات.

import { createScribe } from "scribe-cms/runtime"; import config from "./scribe.config"; const scribe = createScribe(config); const posts = scribe.blog.list("fr"); const { document } = scribe.blog.resolve("hello-world", "fr"); const author = scribe.blog.related(document!, "author");

CLI

تحقق من صحة المحتوى قبل البناء وترجم الصفحات غير المحدثة باستخدام Gemini.

scribe validate <br/> scribe translate --locale fr <br/> scribe status
أمثلة · Scribe