πΌοΈ Building a Visual Content Publishing Site with VitePress & Astro β
βNot all knowledge is text β sometimes, itβs drawn, illustrated, and meant to be seen.β
β Mark Wayne Menorca, Gremoire Collections
Overview β
Developers often rely on VitePress for text-based documentation or personal notes.
But what if your content isnβt just text β what if you want to publish images, visual tutorials, or even manhua-style stories in a lightweight, self-hosted site?
This guide walks you through creating a visual content publishing system using VitePress (for writing) and Astro (for image-based content).
Why Astro over VitePress for Visual Posts β
While VitePress is perfect for text-heavy markdown and technical docs, it has a few limits for visual-first content:
- No built-in image gallery or lazy-loading layout.
- Limited control for multi-image posts.
- No βchapterβ or navigation system for comic-like reading.
Thatβs where Astro shines.
Astro combines the power of markdown + web components to build image-rich layouts while staying fast and deployable to Vercel, Netlify, or GitHub Pages.
Setup β The Hybrid Publishing Stack β
| Purpose | Tool | Notes |
|---|---|---|
| Text-based writing (guides, docs) | VitePress | Your current docs/ site |
| Image-based articles / comics | Astro | Placed in /gallery or /manhua folder |
| Hosting | Vercel | Supports both static sites easily |
| Version Control | GitHub | Syncs both VitePress and Astro builds |
Step 1 β Create the Astro Project β
In your repository root, run:
npm create astro@latest gallery
cd gallery
npm install
npm run dev
Astro will create a starter site in /gallery.
Step 2 β Add MDX and Image Support β
npm install @astrojs/mdx @astrojs/image
Edit your astro.config.mjs:
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import image from '@astrojs/image';
export default defineConfig({
integrations: [mdx(), image()],
site: 'https://yourdomain.vercel.app',
});
This allows you to write Markdown + React-style components and use optimized <Image /> elements.
πΈ Step 3 β Structure Chapters or Visual Articles β
You can organize your visuals like this:
/gallery
ββ public/
β ββ chapters/
β ββ 1/
β β ββ page1.jpg
β β ββ page2.jpg
β ββ 2/
β ββ page1.jpg
β ββ page2.jpg
ββ src/
β ββ layouts/
β β ββ ChapterLayout.astro
β ββ pages/
β ββ index.astro
β ββ chapter-1.mdx
Then in chapter-1.mdx:
---
title: "Chapter 1 β Awakening"
layout: ../layouts/ChapterLayout.astro
---
<Image src="/chapters/1/page1.jpg" alt="Page 1" />
<Image src="/chapters/1/page2.jpg" alt="Page 2" />
Step 4 β Build the Chapter Layout β
src/layouts/ChapterLayout.astro:
---
const { title } = Astro.props;
---
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>{title}</title>
<style>
body {
background: #121212;
color: #f8f8f2;
font-family: 'Inter', sans-serif;
margin: 0;
padding: 0;
}
main {
display: flex;
flex-direction: column;
align-items: center;
}
img {
width: 100%;
max-width: 900px;
border-radius: 8px;
margin: 0.5rem 0;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
</style>
</head>
<body>
<main>
<slot />
</main>
</body>
</html>
Step 5 β Deploy on Vercel β
Add the Astro project to your Vercel Dashboard, set the root directory to /gallery,
and the build command to:
npm run build
Then preview at gallery.yourdomain.com.
Optional: Integrate VitePress + Astro Together β
You can host both at once by merging their static builds:
vitepress build docs
astro build gallery
cp -r gallery/dist/* dist/
Then deploy /dist to your host.
Summary β
| Feature | Tool |
|---|---|
| Markdown articles | VitePress |
| Image/comic posts | Astro |
| Deployment | Vercel |
| Design | Your theme (Monokai / Dark) |
βA Gremoire doesnβt store spells β it stores understanding.
A developerβs Gremoire does the same, but in code, images, and words.β