Really struggling to upgrade (rebuild) from 2

I built a site in 2016 for a government funded nursery school. They love it and especially love the simplicity of kirby. Another school in the same borough wants an almost identical version (they are already associated with the first school so there is no issue regarding design and layout looking similar).

Trying to upgrade that site to Kirby 3 is turning out to be almost a complete rebuild. Sure custom blocks are nice but i already used kirby-builder to do that. It’s not just the panel that i have to adapt, the way the data is inserted into the templates is also different.

How wrong would it be to simply use Kirby 2 again and stick with what I know? The idea was to reskin an existing site, not rebuild it … which would be simpler to do from scratch rather than constantly refactoring and fixing the new to work as the old.

If it was a new site with a new layout and different functionality, then I would happily use and learn v3. But for a literal like for like site, only changing the styles and graphical elements. It would be very time consuming to convert 2 to 3

I understand this can be a pain, and it would probably have been easier to convert to Kirby 3 before 3.5 (i.e., before blocks were introduced). But yes, Kirby 3 was a complete rewrite, especially regarding the Panel, so there are many changes.

As regards Kirby 2, there are some problems:

  • It has reached EOL in December 2021, so there is absolutely no support anymore and in the long run this might become a security problem
  • This also means that with Kirby 2 you are stuck with PHP 7.4, which will reach EOL in December this year
  • You would have to buy a Kirby 3 license for Kirby 2

Hi! I am in a similar situation and also figured that kirby builder the plugin (GitHub - TimOetting/kirby-builder: A site builder extension for Kirby CMS) does not seem to work fully anymore starting from kirby v3.5.

Looking into native kirby 3 builder blocks, I am confused at to why using a mix of json and html data structure (at least for the text block field)? It makes it even harder to write a parser to convert the yaml-ish data structure of kirby builder plugin to kirby native builder block.

Which brings me to the question: what would be a viable, automated, option for converting between data structures? Shall I really write a small parser or is there any other existing approach?

Thanks!

I don’t really understand why after 12 years of brilliant work you ditched plain-text and YAML-ish data structures for an array of JSON objects with HTML strings?

who got this clever idea in the team? how can i edit my website on my desktop using a file browser and a text editor?

Yes, admittedly it becomes almost impossible to edit block field code manually, at least if you want to edit more than just a few words. However, even the builder content wasn’t really intended to be edited manually anymore, at least in my opinion.

But that was not the main reason for the decision to use JSON. The builder (and also our structure field) had quite a few bugs related to YAML and indentation issues. Some of them are related to our YAML parser. So we tried to replace the YAML parser and found out that all alternatives are either a lot stricter and wouldn’t accept a lot of the YAML we advertise in our docs, or they would be much slower. In the end, we decided that JSON is the most stable and fastest format for this type of content.

Edit: the HTML is limited to inline HTML tags (bold, italics etc). Unless you use the writer with headlines, lists etc, but you can disable this.

gotcha, thanks for the clarification.

You can also override the default text block to use a normal textarea field instead of the wysiwyg writer. Then you can set your blocks field to pretty: true and it will save formatted JSON. This way it becomes a bit more manageable.

I’m not sure on this, but AFAIK Kirby should automatically convert the plugin builder fields to the native blocks format if you simply replace the field type in the blueprint

Yes I read that Kirby should do that (Blocks | Kirby CMS), but nothing changed actually.

Unless I need to run some command? I only changed the blueprint so far.

Kirby sees the builder blocks and display them in the Panel, but as one unique text block: eg. instead of displaying 3 blocks (for instance text, image, text), it displays one text string inside a text block.

Hmm, I’ve never had to use the converter, so I don’t really know. You’re still using 3.6.x, right? 3.7 deprecated the converter, it seems.

I don’t think you have to run any command, afaik it should just be able to read the old format, and then the “conversion” happens when saving; like it’s not actively iterating over all your pages, it’s just able to read the builder format.

Are you coming from Kirby 2 or have you already used the builder in a 3.x project?

@texnixe I am converting a kirby v2 website to a kirby v3. Maybe the block type in the docs is referring to the kirby v3 implementation?

I actually had the same problem/effect quite a while ago when converting a Kirby 2 website and didn’t succeed, and in the end couldn’t be bothered and decided to start fresh. I wonder if it works better if you first convert to Kirby 3 builder and then take it from there?

The section in the blocks docs refers to migrating from builder to blocks within Kirby 3, not from Kirby 2 to 3, although I have no idea what the differences are between those builder versions.

I wonder if it works better if you first convert to Kirby 3 builder and then take it from there?

By which you mean re-adding content by hand into the appropriate block using the Editor?

Yes, before doing that I plan to add each type of block and check what is the kirby syntax being used. Then maybe spend 1-2 hours writing a python converter… if it goes longer than that I might do all the work manually otherwise.

The new format seems to be: array of JSON objects with escaped HTML strings. Once I list out all the fields kirby uses when adding a certain block, I might be able to automate it…

No, I meant updating to Kirby 3.x (last version compatible with builder) using the builder for kirby 3, then re-save the content with this Kirby 3 builder, then open in blocks field and see if that works. But since that is not guaranteed, trying it programmatically probably makes more sense.

Ah! Will try. Thanks.

The docs don’t really hint at resaving the existing data in editor — it would be a nice addition IMO (:

Kirby (until 3.7 where it will be removed) has a BlockConverter class that converts Kirby 3 builder blocks to blocks field blocks.

However, the reason why it doesn’t work with Kirby 2 builder, is probably how data is stored in the builder in older version, i.e. from what I can see in the docs, the field type was saved as _fieldset, whereas in the newer version it was stored as _key.

You could therefore try and use this BlockConverter class and change it as needed.

Ended up manually converting the data at last. Was somewhat useful cause some blocks from the K2 builder plugin had custom code and things broke here and there.

It was not a massive amount of articles, but took still 1h 30 mins roughly.