A Cloudflare Worker that redirects to the og:image of any GitHub repository, organization, or user.
https://ghlogo.heathdutton.workers.dev/{owner}
https://ghlogo.heathdutton.workers.dev/{owner}/{repo}
| URL | Redirects to |
|---|---|
| /microsoft | Microsoft's org avatar |
| /microsoft/vscode | VS Code repo's social preview |
| /torvalds | Linus Torvalds' avatar |
| /torvalds/linux | Linux repo's social preview |
<img src="https://ghlogo.heathdutton.workers.dev/owner/repo" alt="Repo Logo">Social previews come back 2:1, which reads as a letterbox next to squarer thumbnails. Add ?ratio= to pad one out:
https://ghlogo.heathdutton.workers.dev/owner/repo?ratio=3:2
https://ghlogo.heathdutton.workers.dev/owner/repo?ratio=4:3
Padding splits evenly between top and bottom, and each half is filled by stretching the image's own edge row. A dark card gets dark bars, a light one gets light. Original pixels are untouched.
PNG only. Indexed color, interlacing, and bit depths other than 8 fall back to the plain redirect, as does any non-PNG.
- Fetches the GitHub page for the given path
- Extracts the
<meta property="og:image">URL - Returns a 302 (temporary) redirect to that image - temporary because the og:image URL changes when owners update their social preview
- Caches the redirect in memory for 1 hour
With ?ratio=, step 3 changes: the worker fetches the PNG itself, pads it, and returns the bytes rather than redirecting.
The in-memory cache persists for the lifetime of the worker isolate, reducing latency for repeated requests.
# Clone
git clone https://github.com/heathdutton/ghlogo.git
cd ghlogo
# Install
npm install
# Test locally
npm run dev
# Deploy (requires wrangler auth)
npm run deployUpdate the name in wrangler.toml to use your own subdomain.
MIT