I am currently building my first site with Kirby and try to learn how to use a custom plugin. So I look at several plugins tutorial and finally try one : Creating a custom block type from scratch.
I have created all the needed files and folders, and it works in the panel block fields !
But one problem remains when i try to have a render of it, by editing the index.js file, it doesn’t work…
panel.plugin("gravezone/dossierspub", {
blocks: {
audio: {
template: `
<div>
Listen to Mr. Pod talk about stuff
</div>
`
}
}
});
I’m quite sure that I forgot something somewhere, but I can’t find where I made the mistakes… Can anyone help me ?
Hm, the code itself is exactly like in the docs. Have you used the same plugin name as in the index.php file? And put the file right next to index.php?
my dossierspub.yml in the blueprints/blocks folder :
name: Dossier de publications
icon: document
fields:
titrecategorie:
label: Titre de la catégorie
type: text
required: true
publications:
label: Publications
type: pages
info: "{{ page.date.todate('M.Y') }}, {{ page.status }}"
empty: Pas encore de publication
query: site.children.template('publications')
size: tiny
layout: cards
sortBy: date desc
image:
cover: false
ratio: 3/2
back: black
the call in the panel:
edito:
label: Édito
icon: text
fields:
text:
label: Contenus publiés
type: blocks
fieldsets:
- heading
- text
- gallery
- dossierspub
textedito:
label: Texte de l'édito
type: textarea
size: large
buttons: false
required: true