Skip to content
MagiCMS

Anti-patterns

Don't hand-edit generated files

These are auto-generated by magicms and will be overwritten on next block install, schema change, or scaffold upgrade:

  • src/components/BlockRenderer.astro
  • src/components/SectionRenderer.astro
  • src/content.config.generated.ts
  • src/lib/jsonLdRegistry.ts
  • src/lib/collectionJsonLdRegistry.ts
  • src/styles/fonts.css
  • src/styles/inline-text-safelist.css

Edit the underlying blocks or schemas instead. Manual edits to these files will be overwritten.

Naming

  • Block names: PascalCase — Hero, TeamGrid. hero will not match Hero.astro on case-sensitive file systems.
  • Field keys: camelCase — heroTitle, backgroundImage.
  • Collection names: camelCase — team, blogPost.
  • Global names: camelCase — header, footer.
  • Slugs: kebab-case — about-us, team-grid.

List vs. translation

Pick one pattern per list field. Don't mark both the list and its sub-fields as translatable. The list flag wins, and the sub-field flags become dead code.

MagicCms ↔ filesystem

  • Case sensitivity: filenames must match the schema _type exactly (PascalCase).
  • Slug collisions: two pages can't share a slug in the same language.
  • Drag-and-drop: ordering is stored in .structure.json (nodes[] order), not in the filesystem.
  • Restoring deleted files: if you delete a .structure.json outside the CMS, the page is gone. Restoring requires a git revert — the CMS cannot recreate it.
Vi bruker cookies for å forbedre din opplevelse.