इसे छोड़कर कंटेंट पर जाएं

Content Management

Collections, entries, locales और releases के साथ एक headless CMS। Content panel या SDK से content manage करें।

Proyecta में एक पूर्ण headless CMS है। यह schema-first है: आप collections (structured content types) define करते हैं, फिर प्रत्येक collection के fields के अनुसार entries बनाते हैं। Entries को localize किया जा सकता है और releases में group किया जा सकता है।

Content को SDK के ज़रिए या AI से पूछकर manage किया जा सकता है। Content API में छह resource types हैं:

Tab / Resourceयह किसलिए है
CollectionsContent schemas define और manage करें (जैसे “Blog Post”, “FAQ”, “Product Spec”)
Fieldsकिसी collection के भीतर typed slots (Collections के sub-resource के रूप में manage किए जाते हैं)
Entriesकिसी collection के भीतर entries browse, create, edit, publish और delete करें
Localestranslated content के लिए language/region locales add और manage करें
Releasesentries को एक साथ live (या unpublish) करने के लिए group करें; releases.publish() के ज़रिए manually publish करें
Assetsmedia files (images, videos, PDFs) upload और manage करें जिन्हें entries से reference किया जा सके

Collections tab में किसी collection पर click करने से उसकी entries पर जाएँ। Entries tab से आप individual content items create, edit, publish और delete कर सकते हैं।

आप SDK (proyecta.content) के ज़रिए सब कुछ programmatically भी manage कर सकते हैं।

Conceptयह क्या है
Collectionएक schema — एक प्रकार के content की shape (जैसे “Blog Post”, “FAQ”, “Product Spec”)
Fieldकिसी collection में एक typed slot (जैसे title: string, body: rich_text, coverImage: asset)
Entryकिसी collection का एक single instance (एक blog post, एक FAQ item)
Assetएक uploaded media file जिसे entries से reference किया जा सके
Localeएक language/region जिसमें content translate किया जाता है
Releaseentries का एक group जो एक ही समय पर live (या unpublish) होने के लिए scheduled हो
import Proyecta from '@proyecta-ai/sdk';
const proyecta = new Proyecta({ apiKey: process.env.PROYECTA_API_KEY });
// 1. Define a collection
const blog = await proyecta.content.collections.create({
api_id: 'blogPost',
name: 'Blog Post',
// fields are added via collections.fields.create()
});
// 2. Create an entry
const post = await proyecta.content.entries.create({
collection_id: blog.id,
data: {
title: 'Hello, world',
body: 'My very first post.',
},
});
// 3. Publish it
await proyecta.content.entries.publish({ entryId: post.id });
// Browse collections
for await (const collection of proyecta.content.collections.list()) {
console.log(collection.name);
}
// Add or remove fields on a collection
await proyecta.content.collections.fields.create(blog.id, {
/* field definition */
});
await proyecta.content.collections.fields.delete(blog.id, fieldId);

Entries वास्तविक content rows होती हैं। प्रत्येक entry किसी collection से संबंधित होती है और उस collection के fields से मेल खाता data रखती है।

// 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 entry
await proyecta.content.entries.update(post.id, { data: { title: 'Updated title' } });
// Publish an entry
await proyecta.content.entries.publish({ entryId: post.id });
// Delete an entry
await proyecta.content.entries.delete(post.id);

Asset uploads पूरी तरह first-class हैं — इनका उपयोग करके अपनी entries में images, videos या PDFs attach करें:

// Browse assets
for await (const asset of proyecta.content.assets.list()) {
console.log(asset);
}
// Upload, update, or delete via assets.create / assets.update / assets.delete

Chat-driven file uploads (drag-into-builder) के लिए देखें Files & Media

Content को कई locales में translate किया जा सकता है। प्रत्येक locale एक record है जिसे proyecta.content.locales के ज़रिए manage किया जाता है:

await proyecta.content.locales.create({
/* code, name, etc. */
});
for await (const locale of proyecta.content.locales.list()) {
console.log(locale);
}

जब आप entries fetch करते हैं, तो किसी specific locale का translation request कर सकते हैं। व्यापक i18n picture के लिए देखें Internationalization

एक release उन entries का bundle होता है जो एक ही समय पर live (या unpublish) होती हैं। इससे आप एक coordinated content drop — कोई marketing launch, नई product page, या FAQ refresh — stage कर सकते हैं और सब कुछ atomically flip हो जाता है।

Note: Automatic timed publishing अभी implement नहीं हुई है। scheduled_at date वाले releases scheduled status में आते हैं लेकिन उन्हें releases.publish() के ज़रिए manually publish करना होगा। निर्धारित समय पर auto-publishing जल्द आने वाली है।

// 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 ready
await proyecta.content.releases.publish({ releaseId: release.id });
// Browse releases
for await (const r of proyecta.content.releases.list()) {
console.log(r);
}

किसी release का schedule बदलने के लिए उसे delete करके दोबारा बनाएँ — कोई update endpoint नहीं है।

सामान्य patterns (AI से wire up करवाएँ)

Section titled “सामान्य patterns (AI से wire up करवाएँ)”
  • "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: कब क्या उपयोग करें”
Use caseयह उपयोग करें
Editorial content (posts, FAQs, marketing copy) — publish/draft states, scheduling, localization की ज़रूरत हैContent API
App data (users, orders, line items) — query speed, transactions, real-time की ज़रूरत हैDatabase
Code में static assetsआपके project में public/ directory
User द्वारा upload की गई filesFiles & Media

जल्द आने वाला है

Section titled “जल्द आने वाला है”
  • Rich-text entry editor — Content panel में rich_text fields के लिए पूर्ण WYSIWYG editing
  • Live preview — आपके app के विरुद्ध content changes का live preview
  • Content roles — editor permissions को developer permissions से अलग करना