File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
app/(marketing)/showcase/[...slug] Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ export default async function PagePage({ params }: PageProps) {
8484 </ h3 >
8585 < ShowcaseCard
8686 title = { doc . title ?? "" }
87- href = { page . url }
87+ href = { doc . href ?? page . url }
8888 image = { doc . image ?? "" }
8989 affiliation = { doc . affiliation ?? "" }
9090 />
Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ import { ChevronRightIcon } from "@radix-ui/react-icons"
55import { showcaseSource } from "@/lib/source"
66import { Marquee } from "@/registry/magicui/marquee"
77
8+ function isExternalHref ( href : string ) {
9+ try {
10+ const url = new URL ( href )
11+ return url . protocol === "http:" || url . protocol === "https:"
12+ } catch {
13+ return false
14+ }
15+ }
16+
817export interface ShowcaseCardProps {
918 title : string
1019 image : string
@@ -17,9 +26,13 @@ export function ShowcaseCard({
1726 href,
1827 affiliation,
1928} : ShowcaseCardProps ) {
29+ const isExternal = isExternalHref ( href )
2030 return (
2131 < Link
2232 href = { href }
33+ prefetch = { isExternal ? false : undefined }
34+ rel = { isExternal ? "noopener noreferrer" : undefined }
35+ target = { isExternal ? "_blank" : undefined }
2336 className = "group relative flex cursor-pointer flex-col gap-2 overflow-hidden"
2437 >
2538 < Image
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ export const showcase = defineDocs({
6363 schema : frontmatterSchema . extend ( {
6464 affiliation : z . string ( ) . optional ( ) ,
6565 featured : z . boolean ( ) . optional ( ) . default ( false ) ,
66+ href : z . string ( ) . url ( ) . optional ( ) ,
6667 image : z . string ( ) . optional ( ) ,
6768 } ) ,
6869 } ,
You can’t perform that action at this time.
0 commit comments