Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

wip

Marc Seitz9149b834b339
diff --git a/components/view/custom-metatag.tsx b/components/view/custom-metatag.tsx
index bc515705..0e43dc6c 100644
--- a/components/view/custom-metatag.tsx
+++ b/components/view/custom-metatag.tsx
@@ -13,11 +13,7 @@ const CustomMetatag = ({
<Head>
{title ? <title>{title}</title> : null}
{description ? (
- <meta
- property="og:description"
- content={description}
- key="description"
- />
+ <meta property="description" content={description} key="description" />
) : null}
{title ? (
<meta property="og:title" content={title} key="og-title" />
diff --git a/pages/view/[linkId]/index.tsx b/pages/view/[linkId]/index.tsx
index e393ffb1..aad507e8 100644
--- a/pages/view/[linkId]/index.tsx
+++ b/pages/view/[linkId]/index.tsx
@@ -64,6 +64,12 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
rootNotionPageId: null, // do not pass rootNotionPageId to the client
recordMap,
},
+ meta: {
+ enableCustomMetatag: link.enableCustomMetatag || false,
+ metaTitle: link.metaTitle,
+ metaDescription: link.metaDescription,
+ metaImage: link.metaImage,
+ },
brand, // pass brand to the client
},
};
@@ -79,6 +85,7 @@ export async function getStaticPaths() {
export default function ViewPage({
link,
notionData,
+ meta,
brand,
}: {
link: LinkWithDocument;
@@ -86,6 +93,12 @@ export default function ViewPage({
rootNotionPageId: string | null;
recordMap: ExtendedRecordMap | null;
};
+ meta: {
+ enableCustomMetatag: boolean;
+ metaTitle: string | null;
+ metaDescription: string | null;
+ metaImage: string | null;
+ } | null;
brand?: Brand;
}) {
const router = useRouter();
@@ -93,9 +106,18 @@ export default function ViewPage({
if (!link || status === "loading" || router.isFallback) {
return (
- <div className="h-screen flex items-center justify-center">
- <LoadingSpinner className="h-20 w-20" />
- </div>
+ <>
+ {meta && meta.enableCustomMetatag ? (
+ <CustomMetatag
+ title={meta.metaTitle}
+ description={meta.metaDescription}
+ imageUrl={meta.metaImage}
+ />
+ ) : null}
+ <div className="h-screen flex items-center justify-center">
+ <LoadingSpinner className="h-20 w-20" />
+ </div>
+ </>
);
}