0
0
NextJSframework~20 mins

Metadata API (static metadata) in NextJS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Metadata Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What is the page title rendered by this Next.js static metadata?
Given this Next.js page component with static metadata, what will be the page title shown in the browser tab?
NextJS
export const metadata = {
  title: 'Welcome to My Site',
  description: 'A simple Next.js app'
};

export default function Page() {
  return <main><h1>Hello World</h1></main>;
}
AA simple Next.js app
BWelcome to My Site
CHello World
DPage
Attempts:
2 left
💡 Hint
Look at the metadata object and see which property sets the page title.
📝 Syntax
intermediate
2:00remaining
Which option correctly defines static metadata in a Next.js page?
Choose the correct syntax to define static metadata for a Next.js page component.
Aexport const metadata = { title: 'Home' };
Bexport function metadata() { return { title: 'Home' }; }
Cconst metadata = { title: 'Home' }; export default metadata;
Dexport default function metadata() { return { title: 'Home' }; }
Attempts:
2 left
💡 Hint
Static metadata must be exported as a constant object, not a function or default export.
state_output
advanced
2:00remaining
What is the description meta tag content rendered by this static metadata?
Given this static metadata in a Next.js page, what will be the content of the description meta tag in the HTML?
NextJS
export const metadata = {
  title: 'About Us',
  description: 'Learn more about our company and team.'
};

export default function About() {
  return <main><h1>About</h1></main>;
}
AAbout Us
BNo description meta tag is rendered
CAbout
DLearn more about our company and team.
Attempts:
2 left
💡 Hint
The 'description' property in metadata sets the meta description tag content.
🔧 Debug
advanced
2:00remaining
Why does this static metadata not update the page title?
This Next.js page has static metadata but the browser tab title remains 'Document'. What is the likely cause?
NextJS
const metadata = {
  title: 'Dashboard'
};

export default function Dashboard() {
  return <main><h1>Dashboard</h1></main>;
}
AThe page component must be named 'Page' for metadata to work.
BThe title property must be inside a function, not an object.
CThe metadata object is not exported, so Next.js ignores it.
DStatic metadata only works in server components, not client components.
Attempts:
2 left
💡 Hint
Check if the metadata object is properly exported for Next.js to detect it.
🧠 Conceptual
expert
2:00remaining
Which statement about Next.js static metadata is TRUE?
Select the true statement about how static metadata works in Next.js 14+.
AStatic metadata is defined as a named export and is used to generate HTML head tags at build time.
BStatic metadata can be dynamically changed at runtime based on user input.
CStatic metadata requires a special hook to update the page title after rendering.
DStatic metadata must be defined inside the page component function to take effect.
Attempts:
2 left
💡 Hint
Think about when static metadata is processed and how it affects the HTML.