591 changes: 579 additions & 12 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -52,6 +52,7 @@
"gatsby-plugin-manifest": "^2.10.0",
"gatsby-plugin-react-helmet": "^3.8.0",
"gatsby-plugin-remove-trailing-slashes": "^2.8.0",
"gatsby-plugin-robots-txt": "^1.6.14",
"gatsby-plugin-sharp": "^2.14.4",
"gatsby-plugin-svgr": "^2.1.0",
"gatsby-plugin-use-dark-mode": "^1.3.0",
Expand Down
23 changes: 13 additions & 10 deletions src/components/atoms/Seo.tsx
Expand Up @@ -6,11 +6,13 @@ import { isBrowser } from '../../utils'
export default function Seo({
title,
description,
uri
uri,
metadescription
}: {
title?: string
description?: string
uri: string
metadescription: string
}): ReactElement {
const { siteTitle, siteTagline, siteUrl, siteImage } = useSiteMetadata()

Expand All @@ -25,17 +27,14 @@ export default function Seo({
>
<html lang="en" />

{isBrowser &&
window.location &&
window.location.hostname !== 'oceanprotocol.com' && (
<meta name="robots" content="noindex,nofollow" />
)}

<link rel="canonical" href={canonical} />

<meta name="description" content={description} />
<meta name="description" content={metadescription || description} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta
property="og:description"
content={metadescription || description}
/>
<meta property="og:url" content={uri} />

<meta
Expand All @@ -48,7 +47,11 @@ export default function Seo({
/>

<meta property="og:site_name" content={siteTitle} />
<meta name="twitter:creator" content="@oceanprotocol" />
{isBrowser &&
window.location &&
window.location.hostname == 'market.oceanprotocol.com' && (
<meta name="twitter:creator" content="@oceanprotocol" />
)}
<meta name="twitter:card" content="summary_large_image" />
</Helmet>
)
Expand Down
9 changes: 8 additions & 1 deletion src/components/templates/Page.tsx
Expand Up @@ -8,6 +8,7 @@ export interface PageProps {
title?: string
uri: string
description?: string
metadescription?: string
noPageHeader?: boolean
headerCenter?: boolean
}
Expand All @@ -17,12 +18,18 @@ export default function Page({
title,
uri,
description,
metadescription,
noPageHeader,
headerCenter
}: PageProps): ReactElement {
return (
<>
<Seo title={title} description={description} uri={uri} />
<Seo
title={title}
description={description}
metadescription={metadescription}
uri={uri}
/>
<Container>
{title && !noPageHeader && (
<PageHeader
Expand Down
9 changes: 7 additions & 2 deletions src/components/templates/PageAssetDetails.tsx
Expand Up @@ -5,15 +5,20 @@ import Page from './Page'
import Alert from '../atoms/Alert'
import Loader from '../atoms/Loader'
import { useAsset } from '../../providers/Asset'
import removeMarkdown from 'remove-markdown'

export default function PageTemplateAssetDetails({
uri
}: {
uri: string
}): ReactElement {
const { ddo, title, error, isInPurgatory, loading } = useAsset()
const { metadata, ddo, title, error, isInPurgatory, loading } = useAsset()
const [pageTitle, setPageTitle] = useState<string>()

const metaDescription = removeMarkdown(
metadata?.additionalInformation?.description?.substring(0, 150) || ''
)

useEffect(() => {
if (!ddo || error) {
setPageTitle('Could not retrieve asset')
Expand All @@ -24,7 +29,7 @@ export default function PageTemplateAssetDetails({
}, [ddo, error, isInPurgatory, title])

return ddo && pageTitle !== undefined && !loading ? (
<Page title={pageTitle} uri={uri}>
<Page title={pageTitle} uri={uri} metadescription={metaDescription}>
<Router basepath="/asset">
<AssetContent path=":did" />
</Router>
Expand Down