Skip to content

Repository files navigation

Nuxt Kirby module

Nuxt Kirby

Kirby CMS data in Nuxt, via KQL or the REST API.

Features

  • 🔒 Protected Kirby credentials on every request
  • 🪢 Supports token-based authentication with the Kirby Headless plugin (recommended)
  • 🍱 Handle requests just like with the useFetch composable
  • 🦦 Multiple starter kits available
  • 🗃 Cached query responses
  • 🤹 No CORS issues
  • 🦾 Strongly typed

Setup

npx nuxt module add kirby

Basic Usage

Add Nuxt Kirby to your Nuxt configuration:

// `nuxt.config.ts`
export default defineNuxtConfig({
  modules: ['nuxt-kirby']
})

And send queries in your template:

<script setup lang="ts">
const { data, error, status } = await useKql({
  query: 'site'
})
</script>

<template>
  <div>
    <h1>{{ data?.result?.title }}</h1>
    <pre>{{ JSON.stringify(data?.result, undefined, 2) }}</pre>
  </div>
</template>

The documentation covers authentication, multi-language sites and every module option.

💻 Development

  1. Clone this repository
  2. Enable Corepack using corepack enable
  3. Install dependencies using pnpm install
  4. Run pnpm run dev:prepare
  5. Start development server using pnpm run dev

License

MIT License © 2022-PRESENT Johann Schopplich

About

🫧 Kirby CMS data in Nuxt, via KQL or the REST API

Topics

Resources

Stars

50 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages