@levino/shipyard-docs
v0.8.0
Published
Documentation plugin for shipyard with automatic sidebar, pagination, and git metadata
Maintainers
Readme
@levino/shipyard-docs
Documentation plugin for shipyard, a general-purpose page builder for Astro.
Installation
npm install @levino/shipyard-docsPeer Dependencies
astro^5.15
Basic Usage
Astro Integration
// astro.config.ts
import shipyardDocs from '@levino/shipyard-docs'
export default defineConfig({
integrations: [
shipyardDocs({
routeBasePath: 'docs',
editUrl: 'https://github.com/user/repo/edit/main/docs',
showLastUpdateTime: true,
showLastUpdateAuthor: true,
}),
],
})Content Collection
// src/content.config.ts (Astro 5+)
import { defineCollection } from 'astro:content'
import { createDocsCollection } from '@levino/shipyard-docs'
const docs = defineCollection(createDocsCollection('./docs'))
export const collections = { docs }Multiple Documentation Instances
// astro.config.ts
export default defineConfig({
integrations: [
shipyardDocs({ routeBasePath: 'docs' }),
shipyardDocs({ routeBasePath: 'guides', collectionName: 'guides' }),
],
})Versioned Documentation
// astro.config.ts
export default defineConfig({
integrations: [
shipyardDocs({
routeBasePath: 'docs',
versions: {
current: 'v2',
available: [
{ version: 'v2', label: 'Version 2.0 (Latest)' },
{ version: 'v1', label: 'Version 1.0', banner: 'unmaintained' },
],
deprecated: ['v1'],
stable: 'v2',
},
}),
],
})With versioned content collection:
// content.config.ts
import { defineCollection } from 'astro:content'
import { createVersionedDocsCollection } from '@levino/shipyard-docs'
const docs = defineCollection(
createVersionedDocsCollection('./docs', {
versions: ['v1', 'v2'],
})
)
export const collections = { docs }Routes
The integration automatically injects these routes:
/[routeBasePath]/[...slug]- Documentation pages (without versioning)/[routeBasePath]/[version]/[...slug]- Versioned documentation pages
With i18n enabled, routes are prefixed with [locale].
Documentation
For complete documentation and examples, visit shipyard.levinkeller.de.
License
MIT
