Editor -> Blocks confusion

Hi lovely Kirby community,

I was researching the custom block type functionality in order to add a button block. Then I read that, with the update, editor to block migration should be pretty easy! So I updated :slight_smile:

After updating, existing blog posts on my site render just fine, but when adding additional blocks to them or creating new blog posts entirely, none of the blocks content actually appear on the page.

Here’s what I’ve done so far.

· Updated my blueprint:

fields:
          introduction:
            label: Introduction
            type: textarea
          text:
            label: Content
            type: blocks

· Updated my template:

<?= $page->text()->toBlocks() ?>

· Updated the snippets and placed them in site/snippets/blocks/ folder:

site/snippets/blocks/code.php
site/snippets/blocks/cta.php
site/snippets/blocks/heading.php
site/snippets/blocks/hr.php
site/snippets/blocks/image.php
site/snippets/blocks/list.php
site/snippets/blocks/markdown.php
site/snippets/blocks/quote.php
site/snippets/blocks/text.php
site/snippets/blocks/video.php

· Deleted site/plugins/editor folder.

The existing .txt content files (that still work!) are formatted like this:

Text:

[
    {
        "attrs": [],
        "content": "Inden for psykologi snakker man om systematiske forvr\u00e6ngninger i menneskets m\u00e5de at g\u00e5 til verden p\u00e5. Med andre ord, s\u00e5 kan den m\u00e5de vi t\u00e6nker om os selv og andre p\u00e5, v\u00e6re disproportional med, hvordan tingene egentlig forholder sig. Disse bliver kaldt for kognitive bias. I litteraturen findes der en hel del bias, men ikke dem alle er lige godt underbygget videnskabeligt. Vi kommer her med 5 bias, som er bredt anerkendt \u2013 og ikke mindst nogle, som vi kan genkende i os selv. Ved at blive opm\u00e6rksomme p\u00e5 nogle af de kognitive vaner vi har, kan vi blive bedre til at se tingene anderledes.",
        "id": "_DmDIB9CtM",
        "type": "paragraph"
    }
]

----

While new files (the ones that don’t work) are formatted like this:


Text: [{"content":{"text":"<p>Tid til en test<\/p>"},"id":"b2350301-a7ce-4812-b4e3-9a1a7dce32ba","isHidden":false,"type":"text"}]

…does the formatting have anything to do with my problem? Or maybe there’s a different idea out there as to what I’m missing?

Thank you so much in advance, I can’t believe the support and curiosity I keep finding in this community!

Oliver

Add a pretty: true property to your text field in your blueprint and you will get a pretty print of the json formatted content in your textfile.

This will not affect your output, so there is still a problem with your snippets. Reading and implementing this cookbook recipe was very helpful to me: Block factory: Creating your own blocks collection | Kirby CMS