Skip to content

Commit

Permalink
chore: Remove /draft and /preview routes from indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Nov 20, 2024
1 parent 9094dbd commit 256f937
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion editor.planx.uk/public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
Disallow: /*draft
Disallow: /*preview
7 changes: 6 additions & 1 deletion editor.planx.uk/src/routes/draft.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { compose, map, mount, route, withData, withView } from "navi";
import { compose, map, mount, route, withData, withHead, withView } from "navi";
import ContentPage from "pages/Preview/ContentPage";
import Questions from "pages/Preview/Questions";
import React from "react";
Expand All @@ -10,6 +10,11 @@ const routes = compose(
mountpath: req.mountpath,
})),

withHead([
<meta name="robots" content="noindex, nofollow" />,
<meta name="googlebot" content="noindex, nofollow" />
]),

withView(async (req) => await draftView(req)),

mount({
Expand Down
7 changes: 6 additions & 1 deletion editor.planx.uk/src/routes/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { compose, map, mount, route, withData, withView } from "navi";
import { compose, map, mount, route, withData, withHead, withView } from "navi";
import ContentPage from "pages/Preview/ContentPage";
import Questions from "pages/Preview/Questions";
import React from "react";
Expand All @@ -10,6 +10,11 @@ const routes = compose(
mountpath: req.mountpath,
})),

withHead([
<meta name="robots" content="noindex, nofollow" />,
<meta name="googlebot" content="noindex, nofollow"/>
]),

withView(async (req) => await previewView(req)),

mount({
Expand Down

0 comments on commit 256f937

Please sign in to comment.