Skip to content

Commit

Permalink
Merge pull request #462 from georgetown-cset/460-add-opengraph-tags
Browse files Browse the repository at this point in the history
Add OpenGraph tags to home and detail pages
  • Loading branch information
jmelot authored Jun 26, 2024
2 parents 4abc0b3 + 1633282 commit 77491bf
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 16 deletions.
112 changes: 104 additions & 8 deletions web/gui-v2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web/gui-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dependencies": {
"@emotion/react": "^11.11.1",
"@eto/eto-ui-components": "^1.8.0",
"@eto/social-cards": "^0.4.3",
"@mdx-js/react": "^2.3.0",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.13.5",
Expand Down
25 changes: 25 additions & 0 deletions web/gui-v2/src/components/MetaTagsWrapper.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';

import { MetaTags } from '@eto/social-cards';
import socialCard from '@eto/social-cards/dist/tools/parat.png';

const MetaTagsWrapper = ({
title = "PARAT \u2013 Emerging Technology Observatory",
subtitle = undefined,
description = "ETO's hub for data on private-sector companies and their AI activities."
}) => {
const fullTitle = subtitle ? `${subtitle} \u2013 ${title}` : title;

return (
<>
<title>{fullTitle}</title>
<MetaTags
title={fullTitle}
description={description}
socialCardUrl={socialCard}
/>
</>
);
};

export default MetaTagsWrapper;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AppWrapper } from '@eto/eto-ui-components';
import DetailView from '../../components/DetailView';
import ParatUsageDisclaimer from '../../components/ParatUsageDisclaimer';
import { company_data as allCompanies } from '../../static_data/data';
import MetaTagsWrapper from '../../components/MetaTagsWrapper';

const CompanyPage = ({ data }) => {
const { cset_id: companyId, name: companyName } = data.companiesJson;
Expand Down Expand Up @@ -36,9 +37,6 @@ export const query = graphql`

export const Head = ({ pageContext }) => {
return (
<>
<html lang="en" />
<title>{pageContext.name} &ndash; PARAT &ndash; Emerging Technology Observatory</title>
</>
<MetaTagsWrapper subtitle={pageContext.name} />
);
};
6 changes: 2 additions & 4 deletions web/gui-v2/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@eto/eto-ui-components';

import ListView from '../components/ListView';
import MetaTagsWrapper from '../components/MetaTagsWrapper';
import ParatUsageDisclaimer from '../components/ParatUsageDisclaimer';

const styles = {
Expand Down Expand Up @@ -65,9 +66,6 @@ export default IndexPage;

export const Head = () => {
return (
<>
<html lang="en" />
<title>PARAT &ndash; Emerging Technology Observatory</title>
</>
<MetaTagsWrapper />
);
};

0 comments on commit 77491bf

Please sign in to comment.