--- /** * Base document layout for every page. * * Replaces Starlight's page shell. It owns the `` (meta, social cards, * CSP, theme bootstrap, analytics) and renders the page body from a slot; the * visible chrome (nav/footer) comes from the `PageShell` React component so it * matches the design prototype exactly. */ import "../styles/base.css"; const SITE_DESCRIPTION = "Community-contributed agents, instructions, and skills to enhance your GitHub Copilot experience"; // Social preview image used for all Open Graph / Twitter cards. The width and // height MUST match the actual pixels of social-image.png. const SOCIAL_IMAGE_WIDTH = "2400"; const SOCIAL_IMAGE_HEIGHT = "1260"; interface Props { title: string; description?: string; /** Page-specific social image path, relative to the site root. */ socialImage?: string; ogType?: string; /** Set false for pages that should not be indexed by search. */ pagefind?: boolean; /** * BCP 47 language tag for the content actually rendered on this page. Most * pages only ever render English, so the default is safe as-is. Locale * routes that have a real translation (see `contentLocale` in * `lib/learning-hub-routes.ts`) must pass their translated locale explicitly — * do not default this to `Astro.currentLocale`, which is the *requested* * locale and is wrong on English-fallback pages (fixes a lang/content * mismatch flagged by Brand Engineering review). */ lang?: string; /** Canonical public path when Astro.url is rewritten by i18n fallback. */ canonicalPath?: string; } const { title, description = SITE_DESCRIPTION, socialImage = "/images/social-image.png", ogType = "website", pagefind = true, lang = "en", canonicalPath, } = Astro.props; const basePath = import.meta.env.BASE_URL; const canonicalUrl = new URL( canonicalPath ?? Astro.url.pathname, Astro.site, ).toString(); const socialImageUrl = new URL(socialImage, Astro.site).toString(); const twitterDomain = Astro.site ? new URL(Astro.site).hostname : undefined; const contentSecurityPolicy = [ "default-src 'self'", "base-uri 'self'", "object-src 'none'", "form-action 'none'", "script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' https://analytics.githubassets.com", "style-src 'self' 'unsafe-inline'", "img-src 'self' data: https:", "font-src 'self' data:", "connect-src 'self' https://raw.githubusercontent.com https://collector.githubapp.com", "frame-src 'self' https://www.youtube.com https://www.youtube-nocookie.com", "media-src 'self' https:", "worker-src 'self' blob:", "upgrade-insecure-requests", ].join("; "); --- {title} {twitterDomain && } {!pagefind && } { import.meta.env.PROD && ( <> ) }