Skip to content

Commit 9069895

Browse files
authored
feat: Add noindex for unpublished datasets (#1169)
1 parent 70c7851 commit 9069895

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

client/package-lock.json

+19-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
"react-dom": "^18.3.1",
9292
"react-draggable": "^4.4.5",
9393
"react-flip-toolkit": "^7.0.12",
94+
"react-helmet-async": "^2.0.5",
9495
"react-icons": "^4.2.0",
9596
"react-markdown": "^9.0.1",
9697
"react-redux": "^7.2.0",

client/src/common/types/entities.ts

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export interface Dataset {
9090
cell_count: number;
9191
dataset_deployments: DatasetDeployment[];
9292
name: string;
93+
published?: boolean;
9394
}
9495

9596
/**

client/src/components/App/App.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import { connect } from "react-redux";
3+
import { Helmet, HelmetData } from "react-helmet-async";
34
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
45
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
56
import actions from "actions";
@@ -34,6 +35,7 @@ interface StateProps {
3435
privacyURL: string;
3536
seamlessEnabled: boolean;
3637
datasetMetadataError: RootState["datasetMetadata"]["error"];
38+
datasetMetadata: RootState["datasetMetadata"];
3739
isCellGuideCxg: RootState["controls"]["isCellGuideCxg"];
3840
scatterplotXXaccessor: RootState["controls"]["scatterplotXXaccessor"];
3941
scatterplotYYaccessor: RootState["controls"]["scatterplotYYaccessor"];
@@ -48,6 +50,7 @@ const mapStateToProps = (state: RootState): StateProps => ({
4850
privacyURL: state.config?.parameters?.about_legal_privacy || "",
4951
seamlessEnabled: selectIsSeamlessEnabled(state),
5052
datasetMetadataError: state.datasetMetadata.error,
53+
datasetMetadata: state.datasetMetadata,
5154
isCellGuideCxg: state.controls.isCellGuideCxg,
5255
scatterplotXXaccessor: state.controls.scatterplotXXaccessor,
5356
scatterplotYYaccessor: state.controls.scatterplotYYaccessor,
@@ -71,14 +74,22 @@ class App extends React.Component<StateProps & { dispatch: AppDispatch }> {
7174
privacyURL,
7275
seamlessEnabled,
7376
datasetMetadataError,
77+
datasetMetadata,
7478
isCellGuideCxg,
7579
differentialExpressionLoading,
7680
scatterplotXXaccessor,
7781
scatterplotYYaccessor,
7882
} = this.props;
7983

84+
const isPublished =
85+
datasetMetadata?.datasetMetadata?.collection_datasets[0]?.published;
86+
const helmetData = new HelmetData({});
87+
8088
return (
8189
<Container>
90+
<Helmet helmetData={helmetData} prioritizeSeoTags>
91+
{!isPublished && <meta name="robots" content="noindex" />}
92+
</Helmet>
8293
<StyledEngineProvider injectFirst>
8394
<EmotionThemeProvider theme={theme}>
8495
<ThemeProvider theme={theme}>

0 commit comments

Comments
 (0)