Skip to content

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

fix: load meta tags right away

Marc Seitzbbc9f684a5c8
diff --git a/pages/view/domains/[domain]/[slug]/index.tsx b/pages/view/domains/[domain]/[slug]/index.tsx
index 9bebef1b..c07b4135 100644
--- a/pages/view/domains/[domain]/[slug]/index.tsx
+++ b/pages/view/domains/[domain]/[slug]/index.tsx
@@ -64,6 +64,11 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
rootNotionPageId: pageId,
recordMap,
},
+ meta: {
+ metaTitle: link.metaTitle,
+ metaDescription: link.metaDescription,
+ metaImage: link.metaImage,
+ },
brand, // pass the brand to client
},
revalidate: 10,
@@ -80,6 +85,7 @@ export async function getStaticPaths() {
export default function ViewPage({
link,
notionData,
+ meta,
brand,
}: {
link: LinkWithDocument;
@@ -87,6 +93,11 @@ export default function ViewPage({
rootNotionPageId: string | null;
recordMap: ExtendedRecordMap | null;
};
+ meta: {
+ metaTitle: string | null;
+ metaDescription: string | null;
+ metaImage: string | null;
+ };
brand?: Brand;
}) {
const router = useRouter();
@@ -94,9 +105,16 @@ 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>
+ <>
+ <CustomMetatag
+ title={meta.metaTitle}
+ description={meta.metaDescription}
+ imageUrl={meta.metaImage}
+ />
+ <div className="h-screen flex items-center justify-center">
+ <LoadingSpinner className="h-20 w-20" />
+ </div>
+ </>
);
}