Existing sites
What prime init finds in a site you already have, how it reads your frontmatter, and what to check afterwards.
bunx @getprimecms/cli init reads your project and writes a prime.config.ts that matches it, so you start from your real content and not a blank schema. Nothing is moved or rewritten: your files stay where they are.
What it finds
It looks in the usual places for Markdown and MDX: src/content, content, data, src/lib/posts, _posts, and src/routes for SvelteKit. It follows nested folders, and if none of those hold Markdown it searches the whole project. Each folder becomes a collection. It prints every collection it found and anything it left out, so nothing disappears silently.
It recognises these frameworks and writes the media folder and preview address each one expects:
| Framework | How you run the admin |
|---|---|
| Astro, Next.js, SvelteKit, Vite, VitePress | An adapter inside your dev server, at /prime. init installs and connects it. |
| Hugo, Jekyll, Eleventy | The standalone admin, bunx @getprimecms/cli dev, next to your generator’s own dev server. |
Some layouts get extra care:
- Hugo: folders of page bundles (
post/hello/index.md) become collections of one-folder-per-entry. TOML frontmatter between+++lines is read and edited as TOML. - Jekyll:
_postsand each_collectionfolder become collections, with the date kept in the file name. Pages in the project root, such asabout.md, become single pages..markdownfiles are included. - Names in any language:
智能合约开发.mdor2022 Annual Summary.mdis listed and edited under its own name.
How it reads your fields
It reads the frontmatter of every file in a folder and models a field only when the files agree on its shape. Only fields present in every file are marked required. Timestamps, nested data and fields whose values differ from file to file are left out of the schema. They are not lost: prime keeps any frontmatter it does not model exactly as it was, with its comments, key order and quoting, and a save changes only the lines you changed. An entry saved with no edits comes back byte for byte.
What to check afterwards
- Open
prime.config.tsand read the fieldsinitinferred. Rename labels, mark fields required, and turn a free-text field into aselectwhere the values are a fixed set. - Give each collection that appears on your site a
url, such as/posts/{slug}, so Preview works. See Configuration. - Run
bunx @getprimecms/cli check. It validates every entry against the schema and lists any file that does not match.
What it does not handle yet
- Hugo’s
_index.mdfiles inside page bundles. - Route pages in SvelteKit (
+page.md) beyond a collection’sbundleFileoption. - Data files such as JSON and YAML. Only Markdown and MDX are read.
- The schema in an Astro
content.config.ts.initinfers fields from your files rather than from that schema. - New entries with a title that has no ASCII letters get an empty slug. Existing files with such names work.
If your site fails in a way not listed here, that is a bug worth reporting at support@primecms.dev.