Consider this Astro component that sets Open Graph metadata for a page. What will be the content of the <meta property="og:title"> tag in the rendered HTML?
--- const title = "Welcome to Astro!"; --- <html lang="en"> <head> <meta property="og:title" content={title} /> <meta property="og:type" content="website" /> </head> <body> <h1>{title}</h1> </body> </html>
Look at the value assigned to the content attribute of the og:title meta tag.
The content attribute of the og:title meta tag is set to the title variable, which is "Welcome to Astro!".
Which of the following code snippets correctly adds Twitter card metadata in an Astro component?
Twitter card metadata uses the name attribute, not property.
The correct syntax for Twitter card metadata uses name="twitter:card" and quotes around the content value.
This Astro component tries to add Open Graph metadata but the tags do not appear in the final HTML source. What is the likely cause?
--- const title = "My Site"; --- <html lang="en"> <head> <meta property="og:title" content={title} /> <meta property="og:type" content="website" /> </head> <body> <h1>{title}</h1> </body> </html>
Check the syntax rules for self-closing tags in Astro components.
In Astro, meta tags must be self-closing with /> at the end. Missing the slash causes the tags to not render properly.
Given this Astro component, what will be the content of the twitter:description meta tag in the rendered HTML?
--- const description = "Best site for learning Astro."; const overrideDesc = false; const twitterDesc = overrideDesc ? "Override description" : description; --- <html lang="en"> <head> <meta name="twitter:description" content={twitterDesc} /> </head> <body> <p>{twitterDesc}</p> </body> </html>
Look at the value of overrideDesc and how twitterDesc is assigned.
Since overrideDesc is false, twitterDesc equals description, which is "Best site for learning Astro.".
In Open Graph metadata, which property must be set to specify the type of content (like article, website, video) for social media previews?
This property tells social platforms what kind of object your page represents.
The og:type property defines the type of content, such as "website", "article", or "video". This helps social media platforms display the preview correctly.
