Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add Open Graph preview image for share app

Anand Baburajan0f93a0fe7ba5
diff --git a/web/apps/share/public/images/preview.png b/web/apps/share/public/images/preview.png
new file mode 100644
index 0000000000..0416bab232
Binary files /dev/null and b/web/apps/share/public/images/preview.png differ
diff --git a/web/apps/share/src/pages/404.tsx b/web/apps/share/src/pages/404.tsx
index 414fc72877..9a136d05a4 100644
--- a/web/apps/share/src/pages/404.tsx
+++ b/web/apps/share/src/pages/404.tsx
@@ -1,3 +1,4 @@
+import { CustomHeadShare } from "ente-base/components/Head";
import React from "react";
import { FileShareView } from "../components/file-share/FileShareView";
@@ -14,7 +15,12 @@ import { FileShareView } from "../components/file-share/FileShareView";
* while preserving the URL in the browser.
*/
const NotFoundPage: React.FC = () => {
- return <FileShareView />;
+ return (
+ <>
+ <CustomHeadShare />
+ <FileShareView />
+ </>
+ );
};
export default NotFoundPage;
diff --git a/web/packages/base/components/Head.tsx b/web/packages/base/components/Head.tsx
index 9096d4a19d..142dd1efbd 100644
--- a/web/packages/base/components/Head.tsx
+++ b/web/packages/base/components/Head.tsx
@@ -89,3 +89,31 @@ export const CustomHeadPhotosOrAlbums: React.FC<CustomHeadProps> = ({
) : (
<CustomHeadAlbums />
);
+
+/**
+ * A static SSR-ed variant of {@link CustomHead} for use with the share app
+ * (Public Locker) deployed on production Ente instances for link previews.
+ *
+ * Similar to {@link CustomHeadAlbums}, this includes Open Graph meta tags with
+ * absolute URLs for social media preview images.
+ */
+export const CustomHeadShare: React.FC = () => (
+ <Head>
+ <title>Ente Locker</title>
+ <link rel="icon" href="/images/favicon.png" type="image/png" />
+ <meta
+ name="description"
+ content="Securely store and share your documents"
+ />
+ <meta
+ property="og:image"
+ content="https://share.ente.io/images/preview.png"
+ />
+ <meta
+ name="twitter:image"
+ content="https://share.ente.io/images/preview.png"
+ />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <meta name="referrer" content="strict-origin-when-cross-origin" />
+ </Head>
+);