0
0
NextJSframework~10 mins

Robots.txt configuration in NextJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the package for robots.txt generation in Next.js.

NextJS
import [1] from 'nextjs-robots';
Drag options to blanks, or click blank then click option'
AgenerateRobots
Brobots
CcreateRobotsTxt
DRobotsTxt
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or incorrect import names.
Trying to import from a wrong package.
2fill in blank
medium

Complete the code to define a basic robots.txt rule allowing all user agents.

NextJS
export const robotsTxtOptions = {
  policies: [
    { userAgent: '*', [1]: true }
  ]
};
Drag options to blanks, or click blank then click option'
Adisallow
Bcrawl
Callow
Dpermit
Attempts:
3 left
💡 Hint
Common Mistakes
Using disallow instead of allow for permitting access.
Using non-existent properties like crawl or permit.
3fill in blank
hard

Fix the error in the robots.txt options to block a specific path '/admin'.

NextJS
export const robotsTxtOptions = {
  policies: [
    { userAgent: '*', disallow: [1] }
  ]
};
Drag options to blanks, or click blank then click option'
A'/admin'
B'admin/'
C/admin
Dadmin
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the leading slash.
Using quotes incorrectly or missing quotes.
4fill in blank
hard

Fill both blanks to add sitemap URL and host in robots.txt options.

NextJS
export const robotsTxtOptions = {
  sitemap: '[1]',
  host: '[2]'
};
Drag options to blanks, or click blank then click option'
Ahttps://example.com/sitemap.xml
Bhttps://example.com
Chttp://example.com
Dhttps://example.org
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing host and sitemap URLs.
Using HTTP instead of HTTPS if site uses HTTPS.
5fill in blank
hard

Fill all three blanks to create a robots.txt component with options and export it as default.

NextJS
import [1] from 'nextjs-robots';

const robots = () => {
  return <[2] options={robotsTxtOptions} />;
};

export default [3];
Drag options to blanks, or click blank then click option'
ARobotsTxt
BRobotsTxtComponent
Crobots
DRobots
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for import and JSX tag.
Exporting the wrong identifier.