Skip to content

Commit

Permalink
chore(SLB-478): gatsby noindex
Browse files Browse the repository at this point in the history
  • Loading branch information
colorfield committed Jan 30, 2025
1 parent 1477408 commit c0741f2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apps/website/gatsby-config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ process.env.CLOUDINARY_API_KEY = process.env.CLOUDINARY_API_KEY || 'test';
process.env.CLOUDINARY_API_SECRET = process.env.CLOUDINARY_API_SECRET || 'test';
process.env.CLOUDINARY_CLOUDNAME = process.env.CLOUDINARY_CLOUDNAME || 'demo';

process.env.NOINDEX = process.env.NOINDEX || 'false';

/**
*
* @type {import('gatsby').GatsbyConfig['plugins']}
Expand Down Expand Up @@ -42,6 +44,12 @@ const plugins = [
options: {
// To avoid "X-Frame-Options: DENY" in Drupal iframes.
mergeSecurityHeaders: false,
headers:
process.env.NOINDEX === 'true'
? {
'/*': ['X-Robots-Tag: noindex, nofollow'],
}
: {},
},
},
{
Expand All @@ -50,7 +58,10 @@ const plugins = [
{
resolve: 'gatsby-plugin-robots-txt',
options: {
policy: [{ userAgent: '*', allow: '/', disallow: [] }],
policy:
process.env.NOINDEX === 'true'
? [{ userAgent: '*', disallow: '/' }]
: [{ userAgent: '*', allow: '/', disallow: [] }],
},
},
{
Expand Down

0 comments on commit c0741f2

Please sign in to comment.