Skip to content

Commit

Permalink
SUL23-693 | fix html validation issue for social share
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccahongsf committed Dec 18, 2024
1 parent 0b738a3 commit 88866bd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/node/stanford-news/page-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const StanfordNews = async ({node, ...props}: {node: NodeStanfordNews}) => {
timeZone: "America/Los_Angeles",
})

const encodeTitle = encodeURIComponent(node.title)

return (
<article {...props} className="centered mt-50">
<StanfordNewsMetadata node={node} />
Expand All @@ -50,7 +52,7 @@ const StanfordNews = async ({node, ...props}: {node: NodeStanfordNews}) => {
<NewsSocialLink
className="text-black transition-colors hocus:text-digital-blue"
prefix="https://twitter.com/intent/tweet?url="
suffix={`&text=${node.title}`}
suffix={`&text=${encodeTitle}`}
>
<span className="sr-only">Stanford Twitter</span>
<TwitterIcon />
Expand All @@ -60,7 +62,7 @@ const StanfordNews = async ({node, ...props}: {node: NodeStanfordNews}) => {
<NewsSocialLink
className="text-black transition-colors hocus:text-digital-blue"
prefix="https://www.linkedin.com/shareArticle?mini=true&url="
suffix={`&title=${node.title}`}
suffix={`&title=${encodeTitle}`}
>
<span className="sr-only">Stanford LinkedIn</span>
<LinkedInIcon />
Expand All @@ -69,7 +71,7 @@ const StanfordNews = async ({node, ...props}: {node: NodeStanfordNews}) => {
<li className="mr-1em">
<NewsSocialLink
className="text-black transition-colors hocus:text-digital-blue"
prefix={`mailto:?subject=${node.title}&body=`}
prefix={`mailto:?subject=${encodeTitle}&body=`}
>
<span className="sr-only">Forward Email</span>
<EnvelopeIcon title="Email" width={28} />
Expand Down

0 comments on commit 88866bd

Please sign in to comment.