Skip to content

Feature/og generator - #122

Open
mrhoodz wants to merge 4 commits into
wwebjs:mainfrom
mrhoodz:feature/og-generator
Open

Feature/og generator#122
mrhoodz wants to merge 4 commits into
wwebjs:mainfrom
mrhoodz:feature/og-generator

Conversation

@mrhoodz

@mrhoodz mrhoodz commented Aug 5, 2026

Copy link
Copy Markdown

📝 Overview

This PR introduces an automated Open Graph (OG) Social Card Image Generator for the documentation site and updates the site's favicon assets to SVG/ICO.

🎨 Design Case Study: View the mini case study on Behance.

  • Social Preview Generator: Dynamically generates custom, high-resolution social preview images for each page during the VuePress build process, ensuring rich metadata cards when links are shared across platforms (Twitter/X, Discord, LinkedIn, Slack, etc.).
  • Favicon Modernization: Upgrades legacy PNG favicons to modern vector SVG and ICO formats for crisp rendering across dark/light browser tabs and high-DPI displays.

3 Opengraph Image

✨ Key Changes

🎨 Design System & OG Social Card Generator

  • Design Case Study: Visual architecture and layout composition documented on Behance.
  • VuePress 2 Plugin (og-generator): Custom VuePress plugin (src/.vuepress/plugins/og-generator.js) hooking into onInitialized to parse pages and build card assets.
  • Dynamic Card Rendering: Uses takumi-js paired with custom fonts (Archivo Black & Poppins) to render 1834x963 template cards with page titles and descriptions.
  • Index Page Optimization: Serves a custom pre-rendered preview image (/images/og-index.png) specifically for the homepage (/).
  • PNG Compression: Integrates sharp with palette quantization and compression settings to produce lightweight PNG files without visual degradation.
  • Automated Meta Tag Injection: Dynamically injects og:image, twitter:image, and twitter:card tags into each page's <head>.
  • Frontmatter Override: Automatically skips card generation if a page explicitly defines a custom og:image in its frontmatter head.
  • Plugin Registration: Wired ogGeneratorPlugin() into src/.vuepress/config.js and src/.vuepress/config/plugins.js.

🏷️ Favicon Modernization

  • SVG & ICO Support: Replaced legacy PNG favicons (logo_16x16.png, logo_32x32.png, logo_shortcut.ico) with crisp vector favicon.svg and favicon.ico fallbacks.
  • Head Configuration: Updated src/.vuepress/config/head.js to reference the new icon formats with proper MIME types.

🛠️ How It Works

  1. During initialization, og-generator loads the background template (og-template.png) and font assets (ArchivoBlack-Regular.ttf & Poppins-Medium.ttf).
  2. Iterates over documentation pages, extracting the page title and description (or sensible fallback values).
  3. Renders the layout via takumi-js, compresses the PNG using sharp, and writes the output to /images/og-gen/<page-slug>.png.
  4. Injects corresponding social meta tags (og:image, twitter:image, twitter:card) into the page <head>.

✅ Verification & Testing

  • Verified local build and dev server (npm run dev) complete without errors.
  • Confirmed generated .png assets output correctly to public/images/og-gen/.
  • Checked DOM output to ensure og:image, twitter:image, and twitter:card meta tags populate expected URLs.
  • Verified vector favicon.svg renders correctly across modern browser tabs.

@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

👷 Deploy request for wwebjs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 8f4e396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants