Files
sign/apps/remix/app/routes/_unauthenticated+/share.$slug.tsx

57 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-01-02 15:33:37 +11:00
import { redirect } from 'react-router';
2025-02-19 16:45:54 +11:00
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
2025-01-02 15:33:37 +11:00
import type { Route } from './+types/share.$slug';
2025-02-19 16:45:54 +11:00
// Todo: (RR7) Test on stg
2025-01-02 15:33:37 +11:00
export function meta({ params: { slug } }: Route.MetaArgs) {
return [
{ title: 'Documenso - Share' },
{ description: 'I just signed a document in style with Documenso!' },
{
property: 'og:title',
title: 'Documenso - Join the open source signing revolution',
},
{
property: 'og:description',
description: 'I just signed with Documenso!',
},
{
property: 'og:type',
type: 'website',
},
{
property: 'og:images',
2025-02-19 16:45:54 +11:00
images: [`${NEXT_PUBLIC_WEBAPP_URL()}/share/${slug}/opengraph`],
2025-01-02 15:33:37 +11:00
},
{
name: 'twitter:site',
site: '@documenso',
},
{
name: 'twitter:card',
card: 'summary_large_image',
},
{
name: 'twitter:images',
2025-02-19 16:45:54 +11:00
images: [`${NEXT_PUBLIC_WEBAPP_URL()}/share/${slug}/opengraph`],
2025-01-02 15:33:37 +11:00
},
{
name: 'twitter:description',
description: 'I just signed with Documenso!',
},
];
}
export const loader = ({ request }: Route.LoaderArgs) => {
const userAgent = request.headers.get('User-Agent') ?? '';
if (/bot|facebookexternalhit|WhatsApp|google|bing|duckduckbot|MetaInspector/i.test(userAgent)) {
return null;
}
2025-02-19 16:45:54 +11:00
// Is hardcoded because this whole meta is hardcoded anyway for Documenso.
throw redirect('https://documenso.com');
2025-01-02 15:33:37 +11:00
};