@astro-community/astro-embed-bluesky
Version:
Component to embed a fully-styled Bluesky post with no client-side JavaScript in your Astro site
9 lines (8 loc) • 318 B
text/typescript
const urlPattern = /^https:\/\/bsky\.app\/profile\/[^/]+\/post\/[^/]+$/;
/**
* Tests if a URL is a Bluesky post URL. If it is, returns the URL, otherwise returns undefined.
*/
export default function matcher(url: string): string | undefined {
const match = url.match(urlPattern);
return match ? url : undefined;
}