Skip to content

Commit

Permalink
Prevent Vercel deployments from being indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
jhildenbiddle committed Dec 19, 2023
1 parent b0d5574 commit e622794
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export default async function middleware(request) {

return new Response(previewHTML, {
status: 200,
headers: { 'content-type': 'text/html' },
headers: {
'content-type': 'text/html',
'x-robots-tag': 'noindex'
},
});
}
10 changes: 9 additions & 1 deletion vercel.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "x-robots-tag", "value": "noindex" }
]
}
],
"redirects": [
{ "source": "/", "destination": "/preview/" }
],
"rewrites": [
{ "source": "/preview/CHANGELOG.md", "destination": "/CHANGELOG.md" },
{ "source": "/preview/:path*", "destination": "/docs/:path*" }
]
}
}

0 comments on commit e622794

Please sign in to comment.