diff --git a/apps/yaak-client/vite.config.ts b/apps/yaak-client/vite.config.ts index da1c6202..40e18e6c 100644 --- a/apps/yaak-client/vite.config.ts +++ b/apps/yaak-client/vite.config.ts @@ -29,6 +29,35 @@ const iconsDir = normalizePath( */ const yaakTarget = process.env.YAAK_TARGET === "web" ? "web" : "desktop"; +const webUrl = "https://web.yaak.app"; +const webDir = normalizePath(path.join(import.meta.dirname, "web")); + +/** Link previews for the hosted web app. Meaningless inside the desktop window. */ +function webHead() { + return { + name: "web-head", + transformIndexHtml() { + const title = "Yaak in your browser"; + const description = "No download, no setup. Open a tab and send your first request."; + return [ + { tag: "meta", attrs: { name: "description", content: description } }, + { tag: "meta", attrs: { property: "og:type", content: "website" } }, + { tag: "meta", attrs: { property: "og:url", content: webUrl } }, + { tag: "meta", attrs: { property: "og:title", content: title } }, + { tag: "meta", attrs: { property: "og:description", content: description } }, + { tag: "meta", attrs: { property: "og:image", content: `${webUrl}/og.png` } }, + { tag: "meta", attrs: { property: "og:image:width", content: "1200" } }, + { tag: "meta", attrs: { property: "og:image:height", content: "630" } }, + { tag: "meta", attrs: { name: "twitter:card", content: "summary_large_image" } }, + { tag: "meta", attrs: { name: "twitter:site", content: "@yaakapp" } }, + { tag: "meta", attrs: { name: "twitter:title", content: title } }, + { tag: "meta", attrs: { name: "twitter:description", content: description } }, + { tag: "meta", attrs: { name: "twitter:image", content: `${webUrl}/og.png` } }, + ]; + }, + }; +} + /** * Where `yaak-web` is listening, taken from the same variables that put it there. * @@ -136,9 +165,19 @@ export default defineConfig(async () => { dest: "", rename: { name: "icon-128.png", stripBase: true }, }, + ...(yaakTarget === "web" + ? [{ src: `${webDir}/og.png`, dest: "", rename: { stripBase: true } }] + : []), ], }), - verifyServedAssets(["cmaps", "standard_fonts", "favicon.ico", "icon-128.png"]), + ...(yaakTarget === "web" ? [webHead()] : []), + verifyServedAssets([ + "cmaps", + "standard_fonts", + "favicon.ico", + "icon-128.png", + ...(yaakTarget === "web" ? ["og.png"] : []), + ]), ], build: { target: "esnext", diff --git a/apps/yaak-client/web/og.html b/apps/yaak-client/web/og.html new file mode 100644 index 00000000..cb78ddb3 --- /dev/null +++ b/apps/yaak-client/web/og.html @@ -0,0 +1,129 @@ + + + + + + + + + + + +
+
+
+ + Yaak +
+

Your favorite API client
in your browser

+

No download, no setup. Open a tab and send your first request.

+
+ GET + https://web.yaak.app + 200 OK +
+
+ + diff --git a/apps/yaak-client/web/og.png b/apps/yaak-client/web/og.png new file mode 100644 index 00000000..efe79e66 Binary files /dev/null and b/apps/yaak-client/web/og.png differ