How to migrate from Squirrelly 7 to Squirrelly 8
- FAQ
- How to migrate from Squirrelly 7 to Squirrelly 8
Section titled TLDR; TLDR;
We currently updated our Squirrely dependency from Version 7 to Version 8 and with this it's needed to update your blok preview templates as well as your advanced path configurations to keep them maintainable over time.
- Object Reference:
- Old: Use
options
as the object reference. - New: Use
it
as the object reference.
- Old: Use
- Loop Syntax:
- Old: Use
{{each(array)}}
and{{foreach(object)}}
. - New: Use
{{@each(array) => val, index}}
and{{@foreach(object) => key, val}}
.
- Old: Use
- Conditional Statements:
- Old: Use
{{if(condition)}}
and{{#else}}
. - New: Use
{{@if(condition)}}
and{{#else}}
.
- Old: Use
- Image Tag:
- Old: Use
{{image(options.image.filename)/}}
. - New: Use
{{@image(it.image.filename)/}}
.
- Old: Use
- Comparison:
- Old: Use
{{if(options.number >= "1")}}
. - New: Use
{{@if(it.number >= "1")}}
.
- Old: Use
- Accessing Properties:
- Old: Access properties directly, e.g.,
{{story.slug}}
. - New: Access properties using the object reference, e.g.,
{{it.story.slug}}
.
- Old: Access properties directly, e.g.,
- Arrow Functions in Loops:
- New: Use arrow functions to destructure values and indices in loops like
{{@each(array) => val, index}}
- New: Use arrow functions to destructure values and indices in loops like
Section titled How to migrate the Blok Preview Template How to migrate the Blok Preview Template
Section titled How to migrate Advanced Path Configurations How to migrate Advanced Path Configurations
Section titled How to migrate configurations with "translatable slugs" How to migrate configurations with "translatable slugs"
With the update to Squirrelly 8 we provide a helper called @activeTranslatedSlug
, you can find out more here.