diff --git a/README.md b/README.md index 4ebd742..6b0fb2f 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,12 @@ Run `pnpm build` (or `pnpm build:preview`) before `pnpm test:e2e` and `pnpm test - Motion is CSS scroll-driven animation, transform-only, and switches off with reduced motion - About 3 KB of our own JavaScript on top of the framework +## Share card + +Links to flutter.ph show this preview on Facebook, X, LinkedIn and chat apps. It is rendered in Chromium with the site's own fonts by `pnpm og` into `public/og.jpg` (1200 x 630). Re-run it after changing the name, tagline or logo. + + + ## Deploy Pushes to `main` build and publish to GitHub Pages through `.github/workflows/deploy.yml`, which also runs daily at midnight Manila time. One-time setup by a maintainer: **Settings > Pages > Source = GitHub Actions**, and the custom domain `flutter.ph`. diff --git a/docs/screenshots/desktop-about.jpg b/docs/screenshots/desktop-about.jpg index e0ef6bb..dd908b0 100644 Binary files a/docs/screenshots/desktop-about.jpg and b/docs/screenshots/desktop-about.jpg differ diff --git a/docs/screenshots/desktop-events.jpg b/docs/screenshots/desktop-events.jpg index 8ede643..97f7f82 100644 Binary files a/docs/screenshots/desktop-events.jpg and b/docs/screenshots/desktop-events.jpg differ diff --git a/package.json b/package.json index 7c813d7..deab161 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "lighthouse": "lhci autorun", "analyze": "ANALYZE=true next build --webpack", "check": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm test && pnpm build:preview && pnpm test:e2e && pnpm test:perf", - "test:perf": "playwright test --config playwright.perf.config.ts" + "test:perf": "playwright test --config playwright.perf.config.ts", + "og": "node scripts/build-og.mjs" }, "dependencies": { "@fontsource-variable/google-sans": "^5.3.2", diff --git a/public/og.jpg b/public/og.jpg new file mode 100644 index 0000000..189961d Binary files /dev/null and b/public/og.jpg differ diff --git a/scripts/build-og.mjs b/scripts/build-og.mjs new file mode 100644 index 0000000..2981752 --- /dev/null +++ b/scripts/build-og.mjs @@ -0,0 +1,51 @@ +#!/usr/bin/env node +// Renders the share card (Open Graph and X/Twitter) to public/og.jpg, 1200x630. +// Uses real Chromium so the card is set in the site's own Google Sans. +// Usage: pnpm og (re-run after changing the name, tagline or logo) +import { chromium } from "@playwright/test"; +import { readFile, writeFile } from "node:fs/promises"; +import sharp from "sharp"; + +const root = new URL("../", import.meta.url); +const font = (w) => + readFile( + new URL( + "node_modules/@fontsource-variable/google-sans/files/google-sans-latin-wght-normal.woff2", + root, + ), + ).then((b) => `data:font/woff2;base64,${b.toString("base64")}`); +const logo = await readFile(new URL("public/flutter-ph-logo.svg", root), "utf8"); +const fontUrl = await font(); + +const html = `
Join thousands of developers, designers and founders building apps with Flutter, Dart and AI.
+