Skip to content

Commit 6cea671

Browse files
WEB-240 - Add No Index to Tutorials staging site (#25)
* Update page.jsx * Add noIndex true * environment check
1 parent b4b5e7c commit 6cea671

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/staging-cd.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
echo GTAG_TRACKING_ID_FOR_GA4=${{ secrets.STAGING_GTAG_TRACKING_ID_FOR_GA4 }} >> .env
3434
echo GTAG_TRACKING_ID_FOR_GTAG=${{ secrets.STAGING_GTAG_TRACKING_ID_FOR_GTAG }} >> .env
3535
cat .env
36+
- name: Set environment
37+
run : sed -i 's/localhost/website.testsigma.com/g' src/environment.ts
3638
- name: Build
3739
run: |
3840
PREFIX_PATHS=true npm run build && npm run deploy

src/environment.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const environment = {
2+
hostname: "localhost",
3+
isStaging() {
4+
return this.hostname == "website.testsigma.com";
5+
}
6+
}

src/templates/page.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {Link} from "../../.cache/gatsby-browser-entry";
1212
import SearchInputBox from "../components/SearchInputBox";
1313
import MobileView from "../components/MobileView";
1414
import Footer from "../components/Footer"
15+
import {environment} from "../environment";
1516

1617
export default ({ data, pageContext }) => {
1718

@@ -35,6 +36,10 @@ export default ({ data, pageContext }) => {
3536
contextualLinks = <SideBar links={post.frontmatter.contextual_links} />;
3637
}
3738

39+
if(environment.isStaging()) {
40+
post.frontmatter.noindex = true;
41+
}
42+
3843
return (
3944
<Layout>
4045
<SEO
@@ -190,4 +195,4 @@ export const query = graphql`
190195
}
191196
}
192197
`;
193-
/* eslint-enaable */
198+
/* eslint-enaable */

0 commit comments

Comments
 (0)