Shared types and utilities for DCS CMS framework packages
npm install @duffcloudservices/cms-corebash
pnpm add @duffcloudservices/cms-core
`
Usage
$3
`typescript
import { resolveTextKey, getPageContent } from '@duffcloudservices/cms-core'
import type { ContentConfiguration } from '@duffcloudservices/cms-core'
const content: ContentConfiguration = {
version: 1,
global: {
'nav.home': 'Home',
'footer.copyright': '© 2026 Company',
},
pages: {
home: {
'hero.title': 'Welcome',
'hero.subtitle': 'Build amazing things',
},
},
}
// Resolve a single key
const title = resolveTextKey(content, 'home', 'hero.title') // 'Welcome'
const nav = resolveTextKey(content, 'home', 'nav.home') // 'Home' (from global)
// Get all content for a page (merged)
const homeContent = getPageContent(content, 'home')
// { 'nav.home': 'Home', 'footer.copyright': '...', 'hero.title': '...', ... }
`
$3
`typescript
import { resolveSeoForPage, buildMetaTags } from '@duffcloudservices/cms-core'
import type { SeoConfiguration } from '@duffcloudservices/cms-core'
const seo: SeoConfiguration = {
version: 1,
global: {
siteName: 'My Site',
defaultTitle: 'My Site',
titleTemplate: '%s | My Site',
},
pages: {
home: {
title: 'Welcome',
description: 'The homepage of My Site',
},
},
}
// Resolve SEO for a page
const resolved = resolveSeoForPage(seo, 'home')
// { title: 'Welcome | My Site', description: '...', ... }
// Build meta tags array
const tags = buildMetaTags(resolved)
// [{ name: 'description', content: '...' }, { property: 'og:title', ... }]
`
$3
`typescript
import { loadContentYaml, loadSeoYaml } from '@duffcloudservices/cms-core'
const content = await loadContentYaml('.dcs/content.yaml')
const seo = await loadSeoYaml('.dcs/seo.yaml')
`
$3
`typescript
import { fetchRuntimeContent } from '@duffcloudservices/cms-core'
// Premium tier only - returns null for non-premium sites
const content = await fetchRuntimeContent('my-site-slug', {
apiBaseUrl: 'https://api.duffcloudservices.com',
})
`
Framework Packages
This core package is used by:
- @duffcloudservices/cms-vue - Vue 3 composables + Vite plugins
- @duffcloudservices/cms-react - React hooks + Vite plugins
- @duffcloudservices/cms-angular - Angular services + build scripts
- @duffcloudservices/cms-astro` - Astro integration