Content
Turn Markdown files into pages you can read, list, and search, and let people edit and publish them.
Deploys on
- Node
- Docker
- Cloudflare
- Vercel
- Netlify
- Deno
server/content.ts
import sqlite from 'comark-content/database/sqlite-node'
import sqliteFullTextSearch
from 'comark-content/plugins/sqlite-full-text-search'
import { defineContent } from 'vite-hub/content'
import { glob } from 'vite-hub/source'
export default defineContent({
// Keep a search index in SQLite
plugins: [
sqliteFullTextSearch({ database: sqlite() }),
],
// Every Markdown file in your docs folder
sources: {
docs: glob({ cwd: 'docs', include: '**/*.md' }),
},
})Search uses optional comark-content plugins. Search configuration shows how to install them and where they store data. You need no Comark setup to read and render Markdown.
Write pages in Markdown
Point Content at a folder of Markdown files. It reads the headings and body of each page.
Read pages from a route
content.get() returns one page. content.navigation() builds a menu from all pages.URLs, head tags, and a sitemap
seo() fields, contentHead() for any framework, and generated /sitemap.xml and /robots.txt.Publish reviewed drafts on a schedule
content.schedule() publishes the reviewed version later. A Schedule Definition runs it on every host.One editor at a time, and everyone sees who
See who is editing. While one person holds the edit lease, writes from others fail with
CONTENT_LEASE_HELD.Edit, publish, and schedule from the terminal
vitehub content lists, edits, and diffs drafts in your running dev server, then publishes or schedules what you reviewed.Read pages from the browser
createContentClient() reads the /api/content route that ViteHub adds for you.Edit, then publish
People edit collection pages in your app. Each save is a draft. Visitors see only what you publish.
One preset stores the collections
extends: cms adds the Workspace, its history tables, and a Database when the app has none.