Skip to content

Commit 2bb482e

Browse files
committed
remove trailing slash in twitter:image
1 parent 3ad7224 commit 2bb482e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/layouts/Layout.astro

+11-5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ export interface Props {
1414
title: string
1515
}
1616
17+
function removeTrailingSlash(str) {
18+
return str.replace(/\/$/, '')
19+
}
20+
1721
const date = new Date()
1822
const dateIso = date.toISOString()
1923
const { title } = Astro.props
2024
const canonicalURL = new URL(Astro.url.pathname, Astro.site)
21-
const ogImage = canonicalURL + codeGenieIntroVideoPoster.src
22-
const ogVideo = canonicalURL + codeGenieIntroVideo
25+
const ogImage =
26+
removeTrailingSlash(canonicalURL.toString()) + codeGenieIntroVideoPoster.src
27+
const ogVideo =
28+
removeTrailingSlash(canonicalURL.toString()) + codeGenieIntroVideo
2329
const description =
2430
'Generate source code for full stack AWS serverless apps with Next.js, React, Express, Lambda, API Gateway, Cognito Auth, DynamoDB, and more based on your data model.'
2531
---
@@ -40,12 +46,12 @@ const description =
4046
optional: {
4147
siteName: 'Code Genie',
4248
description,
43-
video: ogVideo,
49+
// video: ogVideo,
4450
},
4551
}}
4652
twitter={{
47-
site: 'AWSbrett',
48-
creator: 'AWSbrett',
53+
site: '@AWSbrett',
54+
creator: '@AWSbrett',
4955
title: 'Code Genie',
5056
image: ogImage,
5157
card: 'summary_large_image',

0 commit comments

Comments
 (0)