diff --git a/.github/workflows/staging-cd.yml b/.github/workflows/staging-cd.yml index 8d3a829..893ef4d 100644 --- a/.github/workflows/staging-cd.yml +++ b/.github/workflows/staging-cd.yml @@ -33,6 +33,8 @@ jobs: echo GTAG_TRACKING_ID_FOR_GA4=${{ secrets.STAGING_GTAG_TRACKING_ID_FOR_GA4 }} >> .env echo GTAG_TRACKING_ID_FOR_GTAG=${{ secrets.STAGING_GTAG_TRACKING_ID_FOR_GTAG }} >> .env cat .env + - name: Set environment + run : sed -i 's/localhost/website.testsigma.com/g' src/environment.ts - name: Build run: | PREFIX_PATHS=true npm run build && npm run deploy diff --git a/src/environment.ts b/src/environment.ts new file mode 100644 index 0000000..c6b178c --- /dev/null +++ b/src/environment.ts @@ -0,0 +1,6 @@ +export const environment = { + hostname: "localhost", + isStaging() { + return this.hostname == "website.testsigma.com"; + } +} \ No newline at end of file diff --git a/src/templates/page.jsx b/src/templates/page.jsx index fb7d190..70b1410 100644 --- a/src/templates/page.jsx +++ b/src/templates/page.jsx @@ -12,6 +12,7 @@ import {Link} from "../../.cache/gatsby-browser-entry"; import SearchInputBox from "../components/SearchInputBox"; import MobileView from "../components/MobileView"; import Footer from "../components/Footer" +import {environment} from "../environment"; export default ({ data, pageContext }) => { @@ -35,6 +36,10 @@ export default ({ data, pageContext }) => { contextualLinks = ; } + if(environment.isStaging()) { + post.frontmatter.noindex = true; + } + return (