diff --git a/docker-compose.yml b/docker-compose.yml index 466b818..6f4ee7a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,6 +25,7 @@ services: VITE_CV_URL: "${VITE_CV_URL:-/CV/my_cv.pdf}" # e.g. /CV/your-cv.pdf; empty hides CV buttons GITHUB_TOKEN: "${GITHUB_TOKEN:-}" # read-only PAT, set in the gitignored root .env; empty disables the contribution graph ALLOWED_ORIGIN: "${ALLOWED_ORIGIN:-http://localhost:3001}" + SITE_URL: "${SITE_URL:-http://localhost:3001}" # public address, used in link-preview tags FORCE_HTTPS: "${FORCE_HTTPS:-false}" # Only if you set VITE_CV_URL: the CV is never baked into the image. volumes: diff --git a/index.html b/index.html index f7e0b73..56f5217 100644 --- a/index.html +++ b/index.html @@ -14,13 +14,21 @@ name="description" content="__SITE_NAME__, graduate software engineer. Projects, skills, and a homelab." /> + + + + + + + - + + __SITE_NAME__, Graduate Software Engineer diff --git a/public/og-image.jpg b/public/og-image.jpg new file mode 100644 index 0000000..ce2af61 Binary files /dev/null and b/public/og-image.jpg differ diff --git a/server/index.js b/server/index.js index 05c95cb..8c95057 100644 --- a/server/index.js +++ b/server/index.js @@ -199,7 +199,9 @@ let indexHtml = ""; try { indexHtml = fs .readFileSync(path.join(distPath, "index.html"), "utf8") - .replaceAll("__SITE_NAME__", escapeHtml(publicEnv.VITE_NAME || "Your Name")); + .replaceAll("__SITE_NAME__", escapeHtml(publicEnv.VITE_NAME || "Your Name")) + // Absolute URLs for link previews (og:image needs one). Set SITE_URL to the public address. + .replaceAll("__SITE_URL__", escapeHtml((process.env.SITE_URL || ALLOWED_ORIGIN).replace(/\/$/, ""))); } catch { console.warn("dist/index.html not found, run `npm run build` first"); }