Deployment & Environment Variables in Next.js Quiz – 15 Questions with Answers
15 questions · 12 min · Medium
Test your knowledge of metadata and SEO optimization in Next.js, including the Metadata API, title, description, keywords, Open Graph, Twitter cards, robots, sitemaps, canonical URLs, and dynamic metadata.
No sign-up needed · Last updated:
Score: 0 00:00
Create a free account to keep your scores and track your progress. It is optional.
15 questions · 12 min · Medium
15 questions · 12 min · Medium
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
A. Metadata API
Next.js provides the Metadata API for defining metadata in layouts and pages within the App Router.
A. title
The title property of the metadata object is used to define the document title.
A. description
The description metadata field provides a description of the page that can be used by search engines and other platforms.
A. Using an exported metadata object
A page or layout can export a metadata object to define static metadata.
A. generateMetadata
Next.js provides the generateMetadata function for generating metadata dynamically based on parameters, parent metadata, or fetched data.
A. openGraph
The openGraph metadata field can define information such as title, description, URL, and images for Open Graph previews.
A. twitter
The twitter metadata field can be used to configure metadata for Twitter or X card previews.
A. To indicate the preferred URL for a page when similar or duplicate URLs exist
A canonical URL helps search engines understand which URL should be treated as the preferred version of a page.
A. robots
The robots metadata field can define directives such as whether search engines should index a page or follow its links.
A. To provide search engines with information about URLs available for crawling
A sitemap provides search engines with a structured list of URLs that can help them discover pages on a website.
A. sitemap.js
Next.js supports the sitemap.js file convention for generating a sitemap programmatically.
A. robots.js
Next.js supports the robots.js file convention for generating robots.txt content programmatically.
A. It helps search engines and users understand the page topic
A clear, descriptive title provides useful context about the page and can influence how the page appears in search results.
A. Metadata can be shared across pages in that route segment
Metadata defined in a layout can provide shared metadata for pages within that layout hierarchy, while child pages can define additional or overriding metadata.
A. Use generateMetadata with the route parameters
generateMetadata can use dynamic route parameters and other data to create page-specific titles, descriptions, and other metadata.