Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define metadata in a Next.js layout.
NextJS
export const metadata = { title: '[1]' };
export default function RootLayout({ children }) {
return <html><body>{children}</body></html>;
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
children as the title value.Forgetting to export the metadata object.
✗ Incorrect
The metadata object defines the page title for the layout.
2fill in blank
mediumComplete the code to add a description to the metadata object.
NextJS
export const metadata = {
title: 'Home',
description: '[1]'
}; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a component name instead of a description string.
Leaving the description empty.
✗ Incorrect
The description property provides a short summary for the page metadata.
3fill in blank
hardFix the error in the metadata export syntax.
NextJS
export const metadata[1] { title: 'About' };
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using colon instead of equals.
Using arrow function syntax mistakenly.
✗ Incorrect
The correct syntax to export a constant object is export const metadata = { ... }.
4fill in blank
hardFill both blanks to add open graph metadata for title and description.
NextJS
export const metadata = {
openGraph: {
title: '[1]',
description: '[2]'
}
}; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using component names instead of descriptive strings.
Leaving openGraph properties empty.
✗ Incorrect
Open Graph metadata helps social media show rich previews with title and description.
5fill in blank
hardFill all three blanks to define metadata with title, twitter card type, and robots directive.
NextJS
export const metadata = {
title: '[1]',
twitter: {
card: '[2]'
},
robots: {
index: [3]
}
}; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings instead of boolean for robots index.
Using wrong Twitter card type.
✗ Incorrect
This metadata sets the page title, Twitter card type for rich preview, and allows search engines to index the page.