Skip to content

feat: auto gen og #2226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

naitokosuke
Copy link
Contributor

Implement automatic og-image generation from first slide

Hi Slidev maintainers.

Thank you so much for your amazing work on Slidev.
I absolutely love this project!

This is my first feature implementation PR for Slidev, so please let me know if there's anything that needs improvement or if I'm causing any trouble.

I'm happy to make any necessary changes.

Motivation

Currently, Slidev users need to manually create og-images for social media sharing.
The existing workflow requires:

  • Export first slide as PNG

    • Run slidev export --format png --range 1 to generate first slide image
  • Rename and move file

    • Rename 01.png to og-image.png and place in appropriate location
  • Host image somewhere

    • Upload to CDN, GitHub, or image hosting service
  • Configure URL in frontmatter

    seoMeta:
      ogImage: https://example.com/og-image.png

Usage

---
# slides.md frontmatter
seoMeta:
  ogImage: auto # Automatically generates og-image from first slide
---

Copy link

netlify bot commented Jul 13, 2025

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit fa3f904
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/68765ca661441b00082d144a
😎 Deploy Preview https://deploy-preview-2226--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

pkg-pr-new bot commented Jul 13, 2025

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2226

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2226

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2226

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2226

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2226

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2226

commit: fa3f904

@naitokosuke naitokosuke changed the title Feat/auto gen og feat: auto gen og Jul 13, 2025
@naitokosuke naitokosuke marked this pull request as draft July 13, 2025 03:35
@naitokosuke naitokosuke marked this pull request as ready for review July 14, 2025 14:25
@antfu
Copy link
Member

antfu commented Jul 15, 2025

Thanks! That's a great idea!

I think we could improve it even more:

  • We should by default support using og-image.png on the project root
  • With this auto-gen feature, we generate ./og-image.png on the project if it doesn't exist, so users could also commit it to the source control or make modifications to avoid repetitive exporting on CI

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