Challenge - 5 Problems
Open Graph & Twitter Cards Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What does this Next.js component render in the HTML head?
Consider this Next.js component that sets Open Graph and Twitter card meta tags. What will be the content of the tag in the rendered HTML?
NextJS
import Head from 'next/head'; export default function Seo() { return ( <Head> <meta property="og:title" content="Learn Next.js SEO" /> <meta name="twitter:card" content="summary_large_image" /> </Head> ); }
Attempts:
2 left
💡 Hint
Look at the content attribute of the meta tag with property 'og:title'.
✗ Incorrect
The meta tag with property 'og:title' sets the Open Graph title. Its content attribute is 'Learn Next.js SEO', which is what will appear in the HTML head.
📝 Syntax
intermediate2:00remaining
Which option correctly adds a Twitter card meta tag in Next.js?
You want to add a Twitter card meta tag for a summary with a large image in a Next.js component. Which code snippet is syntactically correct and will render the correct meta tag?
NextJS
import Head from 'next/head'; export default function TwitterCard() { return ( <Head> {/* Your meta tag here */} </Head> ); }
Attempts:
2 left
💡 Hint
Meta tags require name and content attributes as strings.
✗ Incorrect
Option D uses correct syntax with name and content attributes as strings. Option D misses the content attribute. Option D misses quotes around content value. Option D reverses attributes but is still valid HTML; however, the standard is name first then content.
🔧 Debug
advanced2:30remaining
Why does this Next.js page not show the Open Graph image on social shares?
This Next.js page includes Open Graph meta tags but the image does not appear when sharing the URL on social media. What is the likely cause?
NextJS
import Head from 'next/head'; export default function Page() { return ( <> <Head> <meta property="og:title" content="My Page" /> <meta property="og:image" content="/images/og-image.png" /> </Head> <main>Content here</main> </> ); }
Attempts:
2 left
💡 Hint
Social media platforms require full URLs for images in Open Graph tags.
✗ Incorrect
Open Graph image URLs must be absolute URLs including the domain. Using a relative path like '/images/og-image.png' will cause social platforms to not find the image.
🧠 Conceptual
advanced1:30remaining
What is the main purpose of Twitter card meta tags in a Next.js app?
Why do developers add Twitter card meta tags to their Next.js pages?
Attempts:
2 left
💡 Hint
Think about what happens when you share a link on Twitter.
✗ Incorrect
Twitter card meta tags define the title, description, and image shown in the preview when a link is shared on Twitter. They do not affect loading speed, authentication, or widgets.
❓ state_output
expert3:00remaining
What is the final HTML output of this Next.js Head component with dynamic Open Graph tags?
Given this Next.js component that uses props to set Open Graph meta tags, what is the rendered HTML inside the when title="Hello World" and image="https://site.com/img.png"?
NextJS
import Head from 'next/head'; export default function DynamicSeo({ title, image }) { return ( <Head> <meta property="og:title" content={title} /> <meta property="og:image" content={image} /> <meta name="twitter:card" content="summary_large_image" /> </Head> ); }
Attempts:
2 left
💡 Hint
Props are used as values for content attributes.
✗ Incorrect
The component uses the props title and image directly as content values. So the rendered meta tags have content="Hello World" and content="https://site.com/img.png" respectively.