Skip to content

Commit fdca6f5

Browse files
authored
Merge pull request #212 from Sangarshanan/main
Add case for missing http in speaker URLs
2 parents 4cef1ca + a671179 commit fdca6f5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pages/speaker/[slug].tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type Speaker = {
1111
slug: string;
1212
affiliation: string;
1313
homepage: string | null;
14+
homepageUrl: string | null;
1415
twitter: string | null;
1516
bioSource: any;
1617
};
@@ -32,6 +33,9 @@ export default function Page({
3233
}) {
3334
const title = `${speaker.name} - EuroPython 2022 | July 11th-17th 2022 | Dublin Ireland & Remote`;
3435
const hasExtra = speaker.affiliation || speaker.homepage || speaker.twitter;
36+
if (speaker.homepage != null) {
37+
speaker.homepageUrl = (speaker.homepage.indexOf('://') === -1) ? 'https://' + speaker.homepage : speaker.homepage;
38+
}
3539

3640
return (
3741
<Layout path={path} title={title}>
@@ -63,11 +67,11 @@ export default function Page({
6367
<dd>{speaker.affiliation}</dd>
6468
</>
6569
)}
66-
{speaker.homepage && (
70+
{speaker.homepageUrl && (
6771
<>
6872
<dt>Homepage</dt>
6973
<dd>
70-
<a href={speaker.homepage}>{speaker.homepage}</a>
74+
<a href={speaker.homepageUrl}>{speaker.homepage}</a>
7175
</dd>
7276
</>
7377
)}

0 commit comments

Comments
 (0)