Skip to content

Commit 2f2e181

Browse files
committed
Fix for Bluesky links and usernames.
1 parent 8eb2cb1 commit 2f2e181

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/pages/speaker/[slug].astro

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ function getTwitterUsername(url: string): string | undefined {
3838
return (username ?? url).startsWith("@") ? username : `@${username}`;
3939
}
4040
41-
// Get @username from BlueSky URL
4241
function getBlueskyUsername(url: string): string | undefined {
43-
const username = url.split("/").pop();
44-
return (username ?? url).startsWith("@") ? username : `@${username}`;
42+
const username = url.split("/").pop()?.replace(/^@/, "");
43+
return username ? `@${username}` : undefined;
44+
}
45+
46+
function getBlueskyProfileLink(username: string): string {
47+
// Remove any leading @ if present
48+
const cleanUsername = username.replace(/^@/, "");
49+
return `https://bsky.app/profile/${cleanUsername}`;
4550
}
4651
4752
// Get @[email protected] from Mastodon URL
@@ -208,7 +213,7 @@ function getGitHosting(url: string): string | undefined {
208213
<dt class="font-bold">Bluesky</dt>
209214
<dd>
210215
<a
211-
href={entry.data.bluesky_url}
216+
href={getBlueskyProfileLink(getBlueskyUsername(entry.data.bluesky_url) as string)}
212217
class="text-primary underline hover:text-primary-hover"
213218
>
214219
{getBlueskyUsername(entry.data.bluesky_url)}

0 commit comments

Comments
 (0)