Skip to content

Commit

Permalink
Add conditional rendering for image meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
erayalkis committed Apr 21, 2022
1 parent 897e0c7 commit a1766e9
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/common/playlists/PlayMeta.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ function PlayMeta({ id, name, description, path, cover, component }) {
<meta name="description" content={description} />
<meta property="og:title" content={name} />
<meta property="og:description" content={description} />
<meta
property="og:image"
content={metaImage}
data-react-helmet="true"
/>
{metaImage && (
<meta
property="og:image"
content={metaImage}
data-react-helmet="true"
/>
)}
<meta
property="og:image:alt"
content={description}
Expand All @@ -39,11 +41,13 @@ function PlayMeta({ id, name, description, path, cover, component }) {
content={description}
data-react-helmet="true"
/>
<meta
name="twitter:image"
content={metaImage}
data-react-helmet="true"
/>
{metaImage && (
<meta
name="twitter:image"
content={metaImage}
data-react-helmet="true"
/>
)}
</Helmet>
{cloneElement(component(), { id })}
</>
Expand Down

0 comments on commit a1766e9

Please sign in to comment.