Skip to main content

MdxPageLayout

MdxPageLayout is the layout behind the integration’s defaultLayout option. It unwraps Astro.props.frontmatter, joins the page title to the site name (Page — Site), forwards everything else to BaseLayout, and renders the frontmatter description as the page’s lead paragraph — the same description-as-lead convention ContentLayout applies on detail routes, so the opening sentence is written once, in frontmatter.

A site’s own wrapper layout stays tiny:

---
// src/layouts/PageLayout.astro
import MdxPageLayout from "astro-theme-university/layouts/MdxPageLayout.astro";
import { siteConfig } from "../site-config";
---

<MdxPageLayout siteConfig={siteConfig} {...Astro.props}><slot /></MdxPageLayout>
// astro.config.ts
universityTheme({
  defaultLayout: "src/layouts/PageLayout.astro",
});

Pass lead={false} in the wrapper to opt out of the lead paragraph while keeping the description in the page’s meta tags.

Prop Type Default Description
siteConfig * SiteConfig & { name: string } --- The site's config object (name, nav, branding …), spread into BaseLayout.
lead boolean true Render the frontmatter description as the page's lead paragraph.
frontmatter Record<string, unknown> --- Frontmatter, supplied automatically when the page is MDX.