Skip to content

Commit

Permalink
SUL23-671 | conditionally render metadata description (#247)
Browse files Browse the repository at this point in the history
* SUL23-671 | conditionally render metadata description

* SUL23-671 | conditionally render metadata description for all pages
  • Loading branch information
rebeccahongsf authored Nov 14, 2024
1 parent 8acdb81 commit bfbe320
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const SulStudyPlaceMetadata = async ({node}: Props) => {
return (
<>
<title>{pageTitle}</title>
<meta name="description" content={description} />
{description && <meta name="description" content={description} />}
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={description} />
{description && <meta property="og:description" content={description} />}

{image && (
<>
Expand All @@ -34,7 +34,7 @@ const SulStudyPlaceMetadata = async ({node}: Props) => {
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={description} />
{description && <meta name="twitter:description" content={description} />}
</>
)
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/node/stanford-news/stanford-news-metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const SulStudyPlaceMetadata = async ({node}: Props) => {
return (
<>
<title>{pageTitle}</title>
<meta name="description" content={description} />
{description && <meta name="description" content={description} />}
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={description} />
{description && <meta property="og:description" content={description} />}
<meta property="og:type" content="article" />
{node.suNewsPublishingDate && (
<meta property="article:published_time" content={new Date(node.suNewsPublishingDate.time).toISOString()} />
Expand All @@ -43,7 +43,7 @@ const SulStudyPlaceMetadata = async ({node}: Props) => {
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={description} />
{description && <meta name="twitter:description" content={description} />}
</>
)
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/node/stanford-page/stanford-page-metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const StanfordPageMetadata = async ({node, isHome}: Props) => {
return (
<>
<title>{pageTitle}</title>
<meta name="description" content={description} />
{description && <meta name="description" content={description} />}
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={description} />
{description && <meta property="og:description" content={description} />}

{image && (
<>
Expand All @@ -38,7 +38,7 @@ const StanfordPageMetadata = async ({node, isHome}: Props) => {
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={description} />
{description && <meta name="twitter:description" content={description} />}
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const StanfordPersonMetadata = async ({node}: Props) => {
return (
<>
<title>{pageTitle}</title>
<meta name="description" content={description} />
{description && <meta name="description" content={description} />}
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={description} />
{description && <meta property="og:description" content={description} />}
<meta property="og:type" content="profile" />
<meta property="profile:first_name" content={node.suPersonFirstName} />
<meta property="profile:last_name" content={node.suPersonLastName} />
Expand All @@ -37,7 +37,7 @@ const StanfordPersonMetadata = async ({node}: Props) => {
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={description} />
{description && <meta name="twitter:description" content={description} />}
</>
)
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/node/sul-library/sul-library-metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const SulLibraryMetadata = async ({node}: Props) => {
return (
<>
<title>{pageTitle}</title>
<meta name="description" content={description} />
{description && <meta name="description" content={description} />}
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={description} />
{description && <meta property="og:description" content={description} />}

{image && (
<>
Expand All @@ -35,7 +35,7 @@ const SulLibraryMetadata = async ({node}: Props) => {
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={description} />
{description && <meta name="twitter:description" content={description} />}
</>
)
}
Expand Down

0 comments on commit bfbe320

Please sign in to comment.