Skip to content

Commit 6f9637a

Browse files
Noindex non-production pages (#13671)
1 parent ebb169a commit 6f9637a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dotcom-rendering/src/server/htmlPageTemplate.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,15 @@ export const htmlPageTemplate = (props: WebProps | AppProps): string => {
7676
config,
7777
} = props;
7878

79-
const doNotIndex = canonicalUrl?.includes('tracking/commissioningdesk');
79+
const doNotIndex = (): boolean => {
80+
const isDevelopment = process.env.GU_STAGE !== 'PROD';
81+
82+
const hasNoIndexPattern = Boolean(
83+
canonicalUrl?.includes('tracking/commissioningdesk'),
84+
);
85+
86+
return isDevelopment || hasNoIndexPattern;
87+
};
8088

8189
/**
8290
* We escape windowGuardian here to prevent errors when the data
@@ -265,7 +273,7 @@ https://workforus.theguardian.com/careers/product-engineering/
265273
<!-- This tag enables pages to be featured in Google Discover as large previews
266274
See: https://developers.google.com/search/docs/advanced/mobile/google-discover?hl=en&visit_id=637424198370039526-3805703503&rd=1 -->
267275
<meta name="robots" content="max-image-preview:large">
268-
${doNotIndex ? '<meta name="robots" content="noindex">' : ''}
276+
${doNotIndex() ? '<meta name="robots" content="noindex">' : ''}
269277
270278
<script>
271279
window.guardian = ${windowGuardian};

0 commit comments

Comments
 (0)