Skip to content

SEO: how to ensure admin ui is not indexed in google? #8985

Answered by iamandrewluca
pnodet asked this question in Questions
Discussion options

You must be logged in to vote

Hey, @pnodet! The simple way is to use extendExpressApp and use express.static middleware

First, create public folder in your project, and add a robots.txt file in there. You should have public/robots.txt with below content:

public/robots.txt

User-agent: *
Disallow: /

Then add express.static middleware to server everything from that folder.

keystone.ts

// ...
import express from 'express';

export default withAuth(
  config({
    // ...
    server: {
      extendExpressApp(app) {
        app.use(express.static('public'))
        // ^ this line serves everything from `public` folder
      },
    }
  })
);

The other way is to configure local storage, but it's much tricky

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pnodet
Comment options

Answer selected by pnodet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants