feat: add url shortner
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
// Client-side redirect: we deliberately don't use `redirect()` from
|
||||
// next/navigation on the server, because that returns a 307 before the OG
|
||||
// `<head>` is ever served. With `generateMetadata` + a 200 body, social-link
|
||||
// scrapers get the full OG card while real users still get redirected.
|
||||
export function RedirectClient({ to }: { to: string }) {
|
||||
const router = useRouter();
|
||||
useEffect(() => {
|
||||
router.replace(to);
|
||||
}, [router, to]);
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user