Docs/Start here/Quickstart

Start here

Quickstart

Connect a Next.js page to your institution’s published content.

Configure the app

Add server-only values to .env.local:

GOVCMS_API_URL=https://api.preview.govcms.one
GOVCMS_SITE_ID=your-provisioned-site-id

Do not prefix these variables with NEXT_PUBLIC_ when used only on the server.

Fetch a page of news

const endpoint = new URL('/v1/public/institutions/content', process.env.GOVCMS_API_URL)
endpoint.searchParams.set('siteId', process.env.GOVCMS_SITE_ID!)
endpoint.searchParams.set('type', 'news')
endpoint.searchParams.set('pageSize', '12')
const response = await fetch(endpoint)
if (!response.ok) throw new Error(`GovCMS returned ${response.status}`)
const result = await response.json()
const articles = result.data.records

The response places site, records, categories and pagination under data.

Render for people first

Use semantic headings, descriptive links and image alternatives. Handle empty lists helpfully. On failure, show a clear error and retry; do not silently replace production content with samples.