Skip to content

Commit

Permalink
WEB-240 - Add No Index to Docs staging site (#112)
Browse files Browse the repository at this point in the history
* WEB-240 - Add No Index to Docs staging site

* WEB-240 - Add No Index to Tutorials staging site

* environment check
  • Loading branch information
shabarish-testsigma authored Jan 17, 2023
1 parent a7115dd commit 36bb7c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/staging-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const environment = {
hostname: "localhost",
isStaging() {
return this.hostname == "website.testsigma.com";
}
}
5 changes: 5 additions & 0 deletions src/templates/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Footer from "../components/Footer";

import 'prismjs/themes/prism-tomorrow.css';
import './page.scss';
import {environment} from "../environment";

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

Expand All @@ -30,6 +31,10 @@ export default ({ data, pageContext }) => {
: null;

const post = data.markdownRemark;
if(environment.isStaging()) {
post.frontmatter.noindex = true;
}

let contextualLinks;
if (post.frontmatter.contextual_links) {
contextualLinks = <SideBar links={post.frontmatter.contextual_links} />;
Expand Down

0 comments on commit 36bb7c1

Please sign in to comment.