voorhoede / head-start

Base setup on top of headless services to help you quickly start a new website
ISC License
3 stars 0 forks source link

feature: DatoCMS collection helper #76

Closed jbmoelker closed 9 months ago

jbmoelker commented 10 months ago

Changes

Simplified example (without types):

import { datocmsCollection } from '@lib/datocms';

const pages = await datocmsCollection({ 
  collection: 'Pages',
  fragment: `slugs: _allSlugLocales { locale, value }`,
});

Associated issue

Resolves #74

How to test

  1. Checkout this branch locally
  2. Force pagination, by changing recordsPerPage to 1 in the new datocmsCollection function in lib/datocms.ts
  3. Run a local build
  4. Verify all the pages are still generated in dist/[locale]/
  5. Verify all the pages are also still generated in the Cloudflare deploy preview

Checklist

cloudflare-workers-and-pages[bot] commented 9 months ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: e4e0b68
Status: ✅  Deploy successful!
Preview URL: https://df81fbc6.head-start.pages.dev
Branch Preview URL: https://feat-datocms-collection.head-start.pages.dev

View logs