Document primitives for building Sitex layouts: Layout renders the html element, LayoutHead the head with SEO meta tags and JSON-LD, plus LayoutBody and LayoutMain for the page shell.
Install
pnpm dlx shadcn@latest add https://sitex.full.dev/r/layout.jsonUsage
import {
Layout,
LayoutBody,
LayoutHead,
LayoutMain,
} from "@/components/ui/layout"
export default function BaseLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<Layout lang="en">
<LayoutHead
name="Acme"
title="Acme — Build sites fast"
description="Static sites with React and MDX."
image={{ src: "/og.png", alt: "Acme", width: 1200, height: 630 }}
twitterCard="summary_large_image"
jsonLd={{
"@context": "https://schema.org",
"@type": "WebSite",
name: "Acme",
}}
/>
<LayoutBody>
<LayoutMain>{children}</LayoutMain>
</LayoutBody>
</Layout>
)
}Key details:
Layout,LayoutBody, andLayoutMainare thin wrappers overhtml,body, andmainwith base styling; all standard element props pass through.LayoutHeadturns props into meta tags:title,description,name(asog:site_name),image(string or object withsrc,alt,width,height,type),openGraphType(aliastype), andtwitterCard(summaryorsummary_large_image).- For
openGraphType="article",publishedAtandupdatedAtemitarticle:published_timeandarticle:modified_time. jsonLdaccepts a singleschema-dtsobject (GraphorWithContext<Thing>) or an array, serialized into ascript type="application/ld+json"tag.- Children of
LayoutHeadrender after the generated tags, so you can add extralinkormetaelements.LayoutHeadPropsandLayoutJsonLdtypes are exported.