Edit on GitHub
Jump to docs navigation

HOWTOs / Twig changes between Bolt 3 and Bolt 4

Note: You are currently reading the documentation for Bolt 4.0. Looking for the documentation for Bolt 5.2 instead?

Approach to migrating a website from Bolt 2/3 to Bolt 4.

  1. Create a new Bolt 4 project at (project name) "Installation"

  2. Enable debug mode on ( project name) (this will help when debugging issues)

  3. Transfer the contenttypes.yaml from Bolt 3 to Bolt 4.* check their current setup, and if they use repeaters: in Bolt 4, this is replicated with using set and collection fields. Therefore, while it should be easy to copy-paste the file, we have to look at how to adopt it best.

  4. Transfer the Twig templates + css files.

  5. There will be errors, not least because the contenttypes.yaml will not be exactly the same. Once we know what this is breaking, we can start fixing those issues one by one, leading to a working website :-)

    *You notice the file extensions have a slightly different name. You need to make sure that when copying the “contenttypes.yml” file you rename it afterwards to “contenttypes.yaml”

    Bolt 2/3 “Contenttypes.yml”

    Bolt 4 “Contenttypes.yaml”

Differences in code encountered:

Tags:

Spaceless

“Bolt 3”

{% spaceless %} - {% end spaceless%} 

Bolt 4”

{% apply spaceless %} - {% endapply %} 

Functions:

Image

“Bolt 3”

<img src=“{{ image(partner, xxx, xxx) }}” alt=”{{partner.title}}”/>

“Bolt 4”

{{ showimage(partner, xxx, xxx) }}

Global variables:

"app.config.get” changed to “config.get"

(app, config). Config was a property of app

“Bolt 3”

{{ app.config.get('general/sitename') }}

“Bolt 4”

{{ config.get('general/sitename') }}

Other changes

  • Repeatable content fields are replaced by “collections” and ”sets” in Bolt 4.

  • The "Conimex extension" for bolt 4 is not compatible with the database exports of Bolt 3 for now.

  • In the future the extension should make it possible to import Bolt 3 database yml files to a Bolt 4 database.



Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.