Skip to content

Commit e4b7323

Browse files
authored
Merge pull request #15951 from artsy/DIA-1432-add-fallback-meta-description-on-fair-pages
fix(fair): adds fallback description and improves meta tags quality
2 parents 3e88318 + b8faa04 commit e4b7323

File tree

6 files changed

+91
-35
lines changed

6 files changed

+91
-35
lines changed

src/Apps/Fair/Components/FairMeta.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,23 @@
1+
import { MetaTags } from "Components/MetaTags"
12
import { getENV } from "Utils/getENV"
23
import type { FairMeta_fair$data } from "__generated__/FairMeta_fair.graphql"
34
import type * as React from "react"
4-
import { Link, Meta, Title } from "react-head"
55
import { createFragmentContainer, graphql } from "react-relay"
66

77
interface FairMetaProps {
88
fair: FairMeta_fair$data
99
}
1010

1111
const FairMeta: React.FC<React.PropsWithChildren<FairMetaProps>> = ({
12-
fair: { name, slug, metaDescription, metaImage },
12+
fair: { name, slug, metaDescription, metaDescriptionFallback, metaImage },
1313
}) => {
14-
const title = `${name} | Artsy`
15-
const href = `${getENV("APP_URL")}/fair/${slug}`
16-
1714
return (
18-
<>
19-
<Title>{title}</Title>
20-
<Meta property="og:title" content={title} />
21-
{metaDescription && (
22-
<>
23-
<Meta name="description" content={metaDescription} />
24-
<Meta property="og:description" content={metaDescription} />
25-
<Meta property="twitter:description" content={metaDescription} />
26-
</>
27-
)}
28-
<Link rel="canonical" href={href} />
29-
<Meta property="og:url" content={href} />
30-
<Meta property="og:type" content="website" />
31-
<Meta property="twitter:card" content="summary" />
32-
{metaImage && <Meta property="og:image" content={metaImage.src} />}
33-
</>
15+
<MetaTags
16+
title={`${name} | Artsy`}
17+
description={metaDescription || metaDescriptionFallback}
18+
pathname={`${getENV("APP_URL")}/fair/${slug}`}
19+
imageURL={metaImage?.src}
20+
/>
3421
)
3522
}
3623

@@ -40,6 +27,7 @@ export const FairMetaFragmentContainer = createFragmentContainer(FairMeta, {
4027
name
4128
slug
4229
metaDescription: summary
30+
metaDescriptionFallback: about(format: PLAIN)
4331
metaImage: image {
4432
src: url(version: "large_rectangle")
4533
}

src/__generated__/FairApp_Test_Query.graphql.ts

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__generated__/FairMeta_fair.graphql.ts

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__generated__/FairSubApp_Query.graphql.ts

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__generated__/fairRoutes_FairQuery.graphql.ts

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__generated__/fairRoutes_FairSubAppQuery.graphql.ts

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)