Skip to content

inaku-Gyan/Slidev-Project-Template

Repository files navigation

Slidev Project Template

A reusable Slidev template for building multiple presentation decks and publishing them as one static GitHub Pages site.

Use This Template

  1. Create a new repository from this template.
  2. Edit decks/demo-one/slides.md or add a new deck under decks/.
  3. Push to main.
  4. In GitHub, open Settings -> Pages, then set Build and deployment to GitHub Actions.

Requirements

  • Node.js 22
  • pnpm 11.6.0

If Corepack is available:

corepack enable
pnpm install
pnpm run skills:install

Local Development

Preview the full deck index with hot reload:

pnpm dev

This starts a local index at http://localhost:3030/ and proxies each discovered deck to its own Slidev dev server.

Preview a single deck by slug without the site proxy:

pnpm dev demo-one

Pass extra Slidev options after --:

pnpm dev demo-one -- --port 4040

Build the full static site:

pnpm run build

Preview the existing static site output:

pnpm preview

The preview server listens on all network interfaces, so devices on the same network can open the printed network URL. pnpm preview does not rebuild; run pnpm run build first after changing slides.

Build

pnpm run build

The static site is generated in dist/.

The home page is generated at dist/index.html. Each deck is generated under its configured public route:

dist/
├── index.html
├── 404.html
├── styles.css
├── demo-one.html
├── demo-one/
│   ├── index.html
│   └── assets/
├── demo-two.html
└── demo-two/
    ├── index.html
    └── assets/

GitHub Pages uses:

pnpm run build

The workflow sets BASE_PATH automatically:

  • https://<user>.github.io/ repositories build with /
  • normal project repositories build with /<repo-name>/

Routes

The generated site uses static file routes:

  • / opens the deck index.
  • /demo-one/ opens the first demo deck when its route is demo-one.
  • /demo-two/ opens the second demo deck when its route is demo-two.
  • /demo-one and /demo-two redirect to the matching trailing-slash route.
  • Unknown paths such as /unknown, /demo-one/foo, and /demo-two/foo return 404.
  • Slide routes use hash URLs, such as /demo-one/#/1, so page refreshes still request the real /demo-one/ entry.

Decks

Each deck lives in decks/<slug>/:

decks/
├── demo-one/
│   ├── deck.json
│   └── slides.md
└── demo-two/
    ├── deck.json
    └── slides.md

slides.md frontmatter provides the home page title and description:

---
title: "Demo Two"
info: |
  A second demo deck that demonstrates multi-deck publishing.
---

deck.json controls site-level sorting, visibility, and the optional public route:

{
  "$schema": "../../schemas/deck.schema.json",
  "order": 2,
  "visibility": "listed",
  "route": "demo-two"
}
  • The directory name is the deck slug for commands, such as pnpm dev demo-one.
  • route is optional and controls the public URL, Slidev base path, and build output directory. If omitted, it defaults to the directory slug.
  • For example, decks/demo-one/deck.json can set "route": "intro" so the command remains pnpm dev demo-one, while the public route is /intro/ and the build output is dist/intro/.
  • title and info from slides.md are shown on the home page.
  • order in deck.json controls home page sorting.
  • visibility in deck.json is optional and defaults to listed:
    • listed appears on the home page and in full-site dev/build.
    • hidden is skipped by full-site dev/build, but direct pnpm dev <slug> and pnpm export <slug> still work.
    • disabled is treated as unavailable, including direct deck commands.

To add another deck, copy decks/demo-two/ to decks/my-talk/, update order, optional visibility, and optional route in deck.json, edit title and info in slides.md, then run pnpm run build.

Export

pnpm export demo-one

If Chromium is missing, install it with:

pnpm exec playwright install chromium

Project Skills

This template treats project skills like generated dependencies.

  • skills-lock.json is committed and is the source of truth.
  • .agents/skills/ is generated locally and ignored by Git.
  • Restore skills manually after installing dependencies.
  • CI does not install project skills because Slidev build does not need them.

Useful commands:

pnpm run skills:install
pnpm run skills:list
pnpm run skills:update

Repository Structure

.
├── decks/
│   ├── demo-one/
│   └── demo-two/
├── site/
│   ├── index.html
│   └── styles.css
├── schemas/
│   └── deck.schema.json
├── scripts/
│   └── build-site.mjs
├── package.json
├── pnpm-lock.yaml
├── skills-lock.json
└── .github/workflows/
    └── deploy-pages.yml

Maintenance

  • Edit slide content in decks/<slug>/slides.md.
  • Edit deck title and description in decks/<slug>/slides.md frontmatter.
  • Edit deck sort order and visibility in decks/<slug>/deck.json.
  • Keep dependencies reproducible with pnpm-lock.yaml.
  • Run pnpm run build before pushing meaningful slide changes.
  • Run pnpm run skills:update when intentionally refreshing project skills.

About

A reusable Slidev template for building presentation decks and publishing them as static GitHub Pages sites.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors