Skip to content

Latest commit

 

History

History
46 lines (42 loc) · 1 KB

crystallize.mdx

File metadata and controls

46 lines (42 loc) · 1 KB
title description type stub service i18nReady
Crystallize & Astro
Add content to your Astro project using Crystallize as a CMS
cms
true
Crystallize
true

Crystallize is a headless content management system for eCommerce that exposes a GraphQL API.

Example

---
// Fetch your catalogue paths from Crystallize GraphQL API

import BaseLayout from '../../layouts/BaseLayout.astro';
import { createClient } from '@crystallize/js-api-client';

const apiClient = createClient({
  tenantIdentifier: 'furniture'
});

const query = `
  query getCataloguePaths{
    catalogue(language: "en", path: "/shop") {
      name
      children {
        name
        path
      }
    }
  }
`
const { data: { catalogue } } = await apiClient.catalogueApi(query)
---
<BaseLayout>
  <h1>{catalogue.name}</h1>
  <nav>
    <ul>
      {catalogue.children.map(child => (
        <li><a href={child.path}>{child.name}</a></li>
      ))}
    </ul>
  </nav>
</BaseLayout>