The Be Sure Blog

Code Snippets | Problem Solving | Tips & Tricks

The Be Sure Blog banner

Add a robots.txt to your Next.js website

posted on 17.2.2023 by Below Surface in "Next.js"

Inside the /public directory add a robots.txt file and add content like this:

User-agent: *
Allow: /
Disallow: /admin

Sitemap: https://www.yourdomain.com/sitemap.xml

For more explanation and settings options, check the resource below.

Tags:

next.js
robots.txt
seo
search engine optimization

Sources:

https://blog.logrocket.com/adding-robots-txt-file-next-js-app/

More posts of this category

Do a static export of a Next.js website

Doing a static export in Next.js is easy and working great on basic web hosting services

Next.js

Change the port of a Next.js app

How to manually set the port from 3000 to any other number

Next.js

Next.js 13 - how to set dynamic HTML head titles

How to take a slug string and turn it into a HTML title tag

Next.js

Suppress Next.js img tag warnings

If you don't want to use their Image elements, this is how to disable the warnings

Next.js

Add Tailwind CSS to your Next.js app

A few commands and some possible error fixing and you are good to go!

Next.js

Next.js 13 Tailwind CSS hot-reload issue fix

With the currently experimental app directory, hot-reload does not work properly

Next.js

How to clear the cache of a Next.js application

How to create a fresh build without any cached data

Next.js

How i finally fixed "sh: 1: next: not found"

My release pipeline failed constantly and it took me three hours to figure out the issue

Next.js

How I fixed "Parsing error: DeprecationError"

'originalKeywordKind' has been deprecated since v5.0.0 (...)

Next.js