Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/template-previews.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Template previews

# Renders every template a PR adds or changes to PNG (defaults, optional text
# empty, long text, light background) and uploads them as the
# "template-previews" artifact, so a review can look at the images without
# running the PR's code locally.
#
# It uses pull_request, so a fork PR runs with a read-only token and no
# secrets, the same as CI.
on:
pull_request:
branches: [dev]
paths:
- 'src/templates/**'
- 'tests/templates/previews.test.ts'
- '.github/workflows/template-previews.yml'

permissions:
contents: read

concurrency:
group: template-previews-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
render:
name: Render changed templates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: List changed templates
id: changed
run: |
set -euo pipefail
# HEAD is GitHub's test merge of the PR into dev, so HEAD^1 is the dev
# commit it was merged onto. pull_request.base.sha can be the dev commit
# from when the PR was opened, which pulls in everything merged since.
changed=$(git diff --name-only --diff-filter=AM HEAD^1 HEAD)
# Template files only: src/templates/<category>/<name>.ts, not the index files.
files=$(grep -E '^src/templates/[^/]+/[^/]+\.ts$' <<<"$changed" | grep -v '/index\.ts$' | head -n 20 | tr '\n' ' ' || true)
# A change to this setup itself renders the reference template, so it gets tested too.
if [ -z "$files" ] && grep -qE '^(tests/templates/previews\.test\.ts|\.github/workflows/template-previews\.yml)$' <<<"$changed"; then
files="src/templates/blog/minimal-dark.ts"
fi
echo "files=$files" >> "$GITHUB_OUTPUT"
echo "Templates to render: ${files:-none}"

- uses: actions/setup-node@v4
if: steps.changed.outputs.files != ''
with:
node-version: 22
cache: npm

- if: steps.changed.outputs.files != ''
run: npm ci

- name: Render
if: steps.changed.outputs.files != ''
env:
PREVIEW_FILES: ${{ steps.changed.outputs.files }}
PREVIEW_OUT: previews
run: npx vitest run tests/templates/previews.test.ts

- uses: actions/upload-artifact@v4
if: steps.changed.outputs.files != ''
with:
name: template-previews
path: previews/
retention-days: 14
if-no-files-found: error

- name: Summary
if: steps.changed.outputs.files != ''
run: |
{
echo "### Template previews"
echo
echo "Download the \`template-previews\` artifact below to see these:"
echo
for f in previews/*.png; do echo "- \`$(basename "$f")\`"; done
} >> "$GITHUB_STEP_SUMMARY"
1 change: 1 addition & 0 deletions .well-known/funding-manifest-urls
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
https://oss.codercops.com/funding.json
https://raw.githubusercontent.com/codercops/.github/main/funding.json
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
[![Discord](https://img.shields.io/badge/chat-Discord-5865F2.svg?logo=discord&logoColor=white)](https://discord.gg/mpGdJyjaRQ)

> Free, open-source OG image generator. 109 templates, 8 platform previews, free API. No login, no watermarks.
> Free, open-source OG image generator. 175+ templates, 8 platform previews, free API. No login, no watermarks.

**Live:** [og.codercops.com](https://og.codercops.com)

![OGCOPS](https://og.codercops.com/api/og?template=github-readme-hero&title=OGCOPS&description=Free%2C+open-source+OG+image+generator.+109+templates.+8+platform+previews.+Free+API.&tagline=No+login+%E2%80%A2+No+watermarks+%E2%80%A2+No+limits&badges=MIT+License&accentColor=%23E07A5F)
![OGCOPS](https://og.codercops.com/api/og?template=github-readme-hero&title=OGCOPS&description=Free%2C+open-source+OG+image+generator.+175%2B+templates.+8+platform+previews.+Free+API.&tagline=No+login+%E2%80%A2+No+watermarks+%E2%80%A2+No+limits&badges=MIT+License&accentColor=%23E07A5F)

## Why OGCOPS?

Expand All @@ -19,13 +19,13 @@ OGCOPS is different:

- **Completely free** — no login, no watermarks, no rate limits
- **Open source** — MIT licensed, self-hostable, fully transparent
- **109 templates** — professional designs across 12 categories, ready to use
- **175+ templates** — professional designs across 12 categories, ready to use
- **Instant preview** — client-side Satori rendering, zero server calls while editing
- **Developer-friendly API** — generate images via URL, CORS-enabled, no API key needed

## Features

- **109 Templates** across 12 categories: Blog, Product, SaaS, GitHub, Event, Podcast, Developer, Newsletter, Quote, E-commerce, Job, Tutorial
- **175+ Templates** across 12 categories: Blog, Product, SaaS, GitHub, Event, Podcast, Developer, Newsletter, Quote, E-commerce, Job, Tutorial
- **8 Platform Previews**: Twitter/X, Facebook, LinkedIn, Discord, Slack, Reddit, WhatsApp, Google Search — see exactly how your image looks on each platform
- **Free REST API**: Generate OG images via URL. CORS-enabled. No API key required.
- **Social Preview Checker**: Paste any URL to analyze its meta tags and see platform previews
Expand Down
Loading
Loading