Skip to main content
InterviewHubPRO
Section Overview
Q23

Question 23 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

46%
Astro Islands & SSR (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

Configuring SEO and OpenGraph Tags cleanly in Astro.

senior LevelCode ExampleSystem DesignAstroData Structures

In Simple Words: Create a reusable <BaseHead /> component:

astro
---
const { title, description, image = '/default-og.png' } = Astro.props;
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
---
<link rel="canonical" href={canonicalURL} />
<title>{title}</title>
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:image" content={new URL(image, Astro.site)} />
<meta name="twitter:card" content="summary_large_image" />