Skip to content

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

fix: meta tag url

Marc Seitzad9d6cbd16da
diff --git a/components/view/access-form/index.tsx b/components/view/access-form/index.tsx
index d48c2f85..5e1d9662 100644
--- a/components/view/access-form/index.tsx
+++ b/components/view/access-form/index.tsx
@@ -44,9 +44,9 @@ export default function AccessForm({
<>
<div className="flex h-screen flex-1 flex-col px-6 py-12 lg:px-8 bg-black">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
- <h2 className="mt-10 text-2xl font-bold leading-9 tracking-tight text-white">
+ <h1 className="mt-10 text-2xl font-bold leading-9 tracking-tight text-white">
Your action is requested to continue
- </h2>
+ </h1>
</div>
<div className="mt-10 sm:mx-auto sm:w-full sm:max-w-md">
diff --git a/components/view/custom-metatag.tsx b/components/view/custom-metatag.tsx
index 0e43dc6c..1dbcdd2e 100644
--- a/components/view/custom-metatag.tsx
+++ b/components/view/custom-metatag.tsx
@@ -13,20 +13,20 @@ const CustomMetatag = ({
<Head>
{title ? <title>{title}</title> : null}
{description ? (
- <meta property="description" content={description} key="description" />
+ <meta name="description" content={description} key="description" />
) : null}
{title ? (
<meta property="og:title" content={title} key="og-title" />
) : null}
{description ? (
<meta
- name="og:description"
+ property="og:description"
content={description}
key="og-description"
/>
) : null}
{imageUrl ? (
- <meta name="og:image" content={imageUrl} key="og-image" />
+ <meta property="og:image" content={imageUrl} key="og-image" />
) : null}
{title ? (
<meta name="twitter:title" content={title} key="tw-title" />
diff --git a/pages/_app.tsx b/pages/_app.tsx
index 7f898e8d..7f45d402 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -46,7 +46,12 @@ export default function App({
content="https://www.papermark.io/_static/meta-image.png"
key="og-image"
/>
- <meta property="og:url" content="https://www.papermark.io" />
+ <meta
+ property="og:url"
+ content="https://www.papermark.io"
+ key="og-url"
+ />
+ <meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@papermarkio" />
<meta name="twitter:creator" content="@papermarkio" />
diff --git a/pages/view/[linkId]/index.tsx b/pages/view/[linkId]/index.tsx
index d21babaf..c5788370 100644
--- a/pages/view/[linkId]/index.tsx
+++ b/pages/view/[linkId]/index.tsx
@@ -11,6 +11,7 @@ import { GetStaticPropsContext } from "next";
import { useRouter } from "next/router";
import { Brand } from "@prisma/client";
import CustomMetatag from "@/components/view/custom-metatag";
+import Head from "next/head";
export const getStaticProps = async (context: GetStaticPropsContext) => {
const { linkId } = context.params as { linkId: string };
@@ -111,6 +112,13 @@ export default function ViewPage({
if (!link || status === "loading" || router.isFallback) {
return (
<>
+ <Head>
+ <meta
+ property="og:url"
+ key="og-url"
+ content={`https://www.papermark.io/view/${router.query.linkId}`}
+ />
+ </Head>
{meta && meta.enableCustomMetatag ? (
<CustomMetatag
title={meta.metaTitle}
@@ -153,6 +161,13 @@ export default function ViewPage({
if (emailProtected || linkPassword) {
return (
<>
+ <Head>
+ <meta
+ property="og:url"
+ key="og-url"
+ content={`https://www.papermark.io/view/${link.id}`}
+ />
+ </Head>
{enableCustomMetatag ? (
<CustomMetatag
title={metaTitle}
@@ -176,6 +191,13 @@ export default function ViewPage({
return (
<>
+ <Head>
+ <meta
+ property="og:url"
+ key="og-url"
+ content={`https://www.papermark.io/view/${link.id}`}
+ />
+ </Head>
{enableCustomMetatag ? (
<CustomMetatag
title={metaTitle}
diff --git a/pages/view/domains/[domain]/[slug]/index.tsx b/pages/view/domains/[domain]/[slug]/index.tsx
index 311d0ffc..96a44aeb 100644
--- a/pages/view/domains/[domain]/[slug]/index.tsx
+++ b/pages/view/domains/[domain]/[slug]/index.tsx
@@ -1,6 +1,5 @@
import LoadingSpinner from "@/components/ui/loading-spinner";
import DocumentView from "@/components/view/document-view";
-import { useDomainLink } from "@/lib/swr/use-link";
import { CustomUser, LinkWithDocument } from "@/lib/types";
import NotFound from "@/pages/404";
import { GetStaticPropsContext } from "next";
@@ -11,7 +10,7 @@ import notion from "@/lib/notion";
import { parsePageId } from "notion-utils";
import { Brand } from "@prisma/client";
import CustomMetatag from "@/components/view/custom-metatag";
-import { log } from "@/lib/utils";
+import Head from "next/head";
export const getStaticProps = async (context: GetStaticPropsContext) => {
const { domain, slug } = context.params as { domain: string; slug: string };
@@ -68,6 +67,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
metaTitle: link.metaTitle,
metaDescription: link.metaDescription,
metaImage: link.metaImage,
+ metaUrl: `https://${domain}/${slug}`,
},
brand, // pass the brand to client
},
@@ -98,6 +98,7 @@ export default function ViewPage({
metaTitle: string | null;
metaDescription: string | null;
metaImage: string | null;
+ metaUrl: string | null;
} | null;
brand?: Brand;
}) {
@@ -108,9 +109,16 @@ export default function ViewPage({
email: string;
};
+ console.log("session", session);
+
if (!link || status === "loading") {
return (
<>
+ {meta && meta.metaUrl ? (
+ <Head>
+ <meta property="og:url" key="og-url" content={meta.metaUrl} />
+ </Head>
+ ) : null}
{meta && meta.enableCustomMetatag ? (
<CustomMetatag
title={meta.metaTitle}
@@ -152,6 +160,11 @@ export default function ViewPage({
if (emailProtected || linkPassword) {
return (
<>
+ {meta && meta.metaUrl ? (
+ <Head>
+ <meta property="og:url" key="og-url" content={meta.metaUrl} />
+ </Head>
+ ) : null}
{enableCustomMetatag ? (
<CustomMetatag
title={metaTitle}
@@ -175,6 +188,11 @@ export default function ViewPage({
return (
<>
+ {meta && meta.metaUrl ? (
+ <Head>
+ <meta property="og:url" key="og-url" content={meta.metaUrl} />
+ </Head>
+ ) : null}
{enableCustomMetatag ? (
<CustomMetatag
title={metaTitle}