Skip to content

Commit

Permalink
fix(app-project): publish /robots.txt for the projects app (#6335)
Browse files Browse the repository at this point in the history
Rewrite `/robots.txt` as `/projects/robots.txt` so that projects staging deploys are hidden behind a `robots.txt` file at https://fe-project.zooniverse.org/robots.txt

Co-authored-by: Delilah C. <[email protected]>
  • Loading branch information
eatyourgreens and goplayoutside3 authored Sep 25, 2024
1 parent f46588e commit 65bee96
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/app-project/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ export function middleware(req, event) {
return NextResponse.next()
}

/*
Serve /projects/robots.txt as /robots.txt.
*/
if (pathname === '/robots.txt') {
url.pathname = '/projects/robots.txt'
return NextResponse.rewrite(url)
}

/*
Redirect /projects/[owner]/[project]?language=[lang] to /projects/[lang]/[owner]/[project].
*/
Expand Down

0 comments on commit 65bee96

Please sign in to comment.