ניהול תוכן
מערכת CMS headless עם קולקציות, רשומות, לוקאלים ומהדורות. נהל תוכן מפאנל ה-Content או דרך ה-SDK.
ל-Proyecta יש מערכת CMS headless מלאה. היא מבוססת-סכמה: אתה מגדיר קולקציות (סוגי תוכן מובנים), ואז יוצר רשומות התואמות לשדות של כל קולקציה. רשומות ניתנות לתרגום ולקיבוץ במהדורות.
פאנל ה-Content
Section titled “פאנל ה-Content”ניתן לנהל תוכן דרך ה-SDK או על ידי שיחה עם ה-AI. ל-Content API יש שישה סוגי משאבים:
| לשונית / משאב | מטרתו |
|---|---|
| Collections | הגדרה וניהול של סכמות תוכן (לדוגמה, “Blog Post”, “FAQ”, “Product Spec”) |
| Fields | שדות מוקלדים בתוך קולקציה (מנוהלים כמשאב-משנה של Collections) |
| Entries | עיון, יצירה, עריכה, פרסום ומחיקה של רשומות בתוך קולקציה |
| Locales | הוספה וניהול של לוקאלי שפה/אזור לתוכן מתורגם |
| Releases | קיבוץ רשומות שיעלו לאוויר (או יורדו) יחד; פרסום ידני דרך releases.publish() |
| Assets | העלאה וניהול של קבצי מדיה (תמונות, סרטונים, PDF) שניתן להפנות אליהם מרשומות |
לחץ על קולקציה בלשונית Collections כדי לקפוץ לרשומות שלה. לשונית Entries מאפשרת לך ליצור, לערוך, לפרסם ולמחוק פריטי תוכן בודדים.
ניתן גם לנהל הכל באופן תוכנתי דרך ה-SDK (proyecta.content).
מושגים
Section titled “מושגים”| מושג | מה הוא |
|---|---|
| Collection | סכמה — המבנה של סוג תוכן אחד (לדוגמה, “Blog Post”, “FAQ”, “Product Spec”) |
| Field | שדה מוקלד בקולקציה (לדוגמה, title: string, body: rich_text, coverImage: asset) |
| Entry | מופע יחיד של קולקציה (פוסט בלוג אחד, פריט FAQ אחד) |
| Asset | קובץ מדיה שהועלה וניתן להפנות אליו מרשומות |
| Locale | שפה/אזור שהתוכן מתורגם אליו |
| Release | קבוצה של רשומות המתוזמנות לעלות לאוויר (או לרדת) בו-זמנית |
התחלה מהירה
Section titled “התחלה מהירה”import Proyecta from '@proyecta-ai/sdk';
const proyecta = new Proyecta({ apiKey: process.env.PROYECTA_API_KEY });
// 1. Define a collectionconst blog = await proyecta.content.collections.create({ api_id: 'blogPost', name: 'Blog Post', // fields are added via collections.fields.create()});
// 2. Create an entryconst post = await proyecta.content.entries.create({ collection_id: blog.id, data: { title: 'Hello, world', body: 'My very first post.', },});
// 3. Publish itawait proyecta.content.entries.publish({ entryId: post.id });קולקציות
Section titled “קולקציות”// Browse collectionsfor await (const collection of proyecta.content.collections.list()) { console.log(collection.name);}
// Add or remove fields on a collectionawait proyecta.content.collections.fields.create(blog.id, { /* field definition */});await proyecta.content.collections.fields.delete(blog.id, fieldId);רשומות
Section titled “רשומות”רשומות הן שורות התוכן הממשיות. כל רשומה שייכת לקולקציה ומכילה נתונים התואמים לשדות אותה קולקציה.
// Browse entries (pass the collection's api_id, not its numeric id)for await (const entry of proyecta.content.entries.list({ collection: 'blogPost' })) { console.log(entry);}
// Update an entryawait proyecta.content.entries.update(post.id, { data: { title: 'Updated title' } });
// Publish an entryawait proyecta.content.entries.publish({ entryId: post.id });
// Delete an entryawait proyecta.content.entries.delete(post.id);נכסים (Assets)
Section titled “נכסים (Assets)”העלאת assets היא פעולה מהשורה הראשונה — השתמש בה כדי לצרף תמונות, סרטונים או קבצי PDF לרשומות שלך:
// Browse assetsfor await (const asset of proyecta.content.assets.list()) { console.log(asset);}
// Upload, update, or delete via assets.create / assets.update / assets.deleteלהעלאת קבצים דרך הצ’אט (גרירה לתוך ה-builder), ראה קבצים ומדיה.
לוקליזציה
Section titled “לוקליזציה”ניתן לתרגם תוכן למספר לוקאלים. כל לוקאל הוא רשומה המנוהלת דרך proyecta.content.locales:
await proyecta.content.locales.create({ /* code, name, etc. */});
for await (const locale of proyecta.content.locales.list()) { console.log(locale);}כשאתה מושך רשומות, ניתן לבקש את התרגום של לוקאל מסוים. ראה אינטרנציונליזציה לתמונה הכוללת של i18n.
מהדורות (Releases)
Section titled “מהדורות (Releases)”מהדורה היא חבילה של רשומות שעולות לאוויר (או יורדות) בו-זמנית. זה מאפשר לך לתזמן השקת תוכן מתואמת — השקה שיווקית, דף מוצר חדש, עדכון FAQ — וכל הדברים יתהפכו בצורה אטומית.
הערה: פרסום אוטומטי מתוזמן עדיין לא מיושם. מהדורות עם תאריך
scheduled_atנכנסות לסטטוסscheduledאך יש לפרסם אותן ידנית דרךreleases.publish(). פרסום אוטומטי בזמן שנקבע יגיע בקרוב.
// Create a release (optionally with a target date)const release = await proyecta.content.releases.create({ name: 'Monday launch', scheduled_at: '2024-01-08T09:00:00Z',});
// Manually publish a release when readyawait proyecta.content.releases.publish({ releaseId: release.id });
// Browse releasesfor await (const r of proyecta.content.releases.list()) { console.log(r);}כדי לשנות את לוח הזמנים של מהדורה, מחק אותה וצור אותה מחדש — אין endpoint לעדכון.
דפוסים נפוצים (תן ל-AI לחבר הכל)
Section titled “דפוסים נפוצים (תן ל-AI לחבר הכל)”"Build a blog using the Proyecta Content API. Collection 'Blog Post' with fields: title, slug, excerpt, body (rich text), coverImage (asset), author. Public route at /blog and /blog/[slug].""Create an FAQ collection in Proyecta Content. Build an admin page where I can add/edit FAQs and a public /faq page.""Set up a multi-language landing page using Proyecta Content with English and Spanish locales.""Create a release containing three blog posts and publish it manually when ready."
מתי להשתמש ב-Content לעומת Database
Section titled “מתי להשתמש ב-Content לעומת Database”| מקרה שימוש | השתמש בזה |
|---|---|
| תוכן עריכתי (פוסטים, שאלות נפוצות, תוכן שיווקי) — נדרשים מצבי פרסום/טיוטה, תזמון, לוקליזציה | Content API |
| נתוני אפליקציה (משתמשים, הזמנות, פריטי שורה) — נדרשים מהירות שאילתה, טרנזקציות, real-time | Database |
| נכסים סטטיים בקוד | ספריית public/ בפרויקט שלך |
| קבצים שהמשתמש העלה | קבצים ומדיה |
- עורך rich-text לרשומות — עריכת WYSIWYG מלאה לשדות
rich_textבפאנל ה-Content - תצוגה מקדימה חיה של שינויי תוכן מול האפליקציה שלך
- תפקידי תוכן — הפרדת הרשאות עורך מהרשאות מפתח