nuxt-kirby
nuxt-kirby
Fetch Kirby CMS data via KQL or the REST API
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
useFetchcomposable - 🦦 Multiple starter kits available
- 🗃 Cached query responses
- 🤹 No CORS issues
- 🦾 Strongly typed
Setup
Add the module to a project on Nuxt 4.6 or a later Nuxt 4 release:
npx nuxt module add kirbyBasic Usage
Set your Kirby credentials in .env. This example uses basic authentication with the KQL plugin; Getting Started sets up token authentication instead:
NUXT_KIRBY_URL=https://kirby.example.com
NUXT_KIRBY_CREDENTIALS_USERNAME=your-username
NUXT_KIRBY_CREDENTIALS_PASSWORD=your-passwordAnd 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
- Clone this repository
- Enable Corepack using
corepack enable - Install dependencies using
pnpm install - Run
pnpm run dev:prepare - Start development server using
pnpm run dev
License
MIT License © 2022-PRESENT Johann Schopplich
