🚫🔍 feat: disallow search indexing (#1409)

* feat: disallow search indexing

* Update index.js

* Update .env.example

* added middleware
This commit is contained in:
Marco Beretta 2023-12-30 02:42:04 +01:00 committed by GitHub
parent c3d5a08b26
commit bd4d23d314
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,11 @@
const noIndex = (req, res, next) => {
const shouldNoIndex = process.env.NO_INDEX ? process.env.NO_INDEX === 'true' : true;
if (shouldNoIndex) {
res.setHeader('X-Robots-Tag', 'noindex');
}
next();
};
module.exports = noIndex;