Skip to content
MagiCMS

Layouts

_Base.astro

The HTML shell. It includes:

  • <head> with meta tags, fonts, daisyUI theme, JSON-LD, analytics script slot.
  • A navbar that reads navigation.items (Alpine hover dropdown, mobile sidesheet).
  • A footer with site name, language switcher, and CookieBanner.
  • <slot name="head" /> for blocks targeted at target: "head".
  • <ClientRouter /> from astro:transitions for View Transitions.

Article.astro

A thin wrapper around _Base that adds max-w-6xl mx-auto px-6 py-12. This is the Default starter layout — the article owns max width and padding.

Custom layouts

Add a new file in src/layouts/. Without an _ prefix, it appears in the MagiCMS layout dropdown. With an _ prefix, it is private (used as a base by other layouts).

Wrapping pattern: import _Base.astro, render <Layout title={...}><slot/></Layout> and add your own container.

Block targets

  • target: "main" (default) — block renders inside the layout's <main> via BlockRenderer. Must wrap content in <Wrapper> (provides mb-8 and any common classes).
  • target: "head" — block renders inside _Base.astro's <slot name="head" />. Must not use <Wrapper> (would render a stray <div> in <head>).

Typical head blocks: SEO, PageJsonLd, Analytics, SiteFonts.

Vi bruker cookies for å forbedre din opplevelse.