This plugin allows ease of access to all of your Kirby pages on sites that use the KQL plugin
npm i nuxt-kirby-kql
yarn add nuxt-kirby-kql
nuxt.conf
publicRuntimeConfig: {
kirby: {
url: process.env.KIRBY_SITE || 'XXX',
username: process.env.KIRBY_USERNAME || 'XXX',
password: process.env.KIRBY_PASSWORD || 'XXX'
}
},
plugins: [
'./node_modules/nuxt-kirby-kql'
],
The plugin exposes globally $kirby
on the components this
To make a KQL request, simply call the find()
method passing the KQL request.
Reponse includes
Property | Type | Description |
---|---|---|
ok | Boolean | If the request was successful or not |
status | Number | HTTP response code |
statusText | Strong | HTTP status text |
json | String | Reponse payload |
const { json: page } = await this.$kirby.find({
"query": "page('photography').children",
"select": {
"url": true,
"title": true,
"text": "page.text.markdown",
"images": {
"query": "page.images",
"select": {
"url": true
}
}
},
"pagination": {
"limit": 10
}
})
return { page }
MIT
I release stuff for free, feel free to use this however you wish, if you like it, I am a coffee addict, help me pay for more coffee https://www.buymeacoffee.com/danielrivers
Thanks to
- @HashandSalt for being first user and tester
- The whole @getkirby team