Tuesday, 7 September 2021

How to get for loop index in SXA scriban

 

Adding something to the first item in a loop. As an example, below adding the active class to a bootstrap element, useful for tabs, menus, carousels, modals etc.

{{if for.first == true}} active{{end}}

Also, from the same artist:

  • `{{for.index}}` The current index of the for loop

  • `{{for.rindex}}` The current index of the for loop starting from the end of the list

  • `{{for.first}}` A boolean indicating whether this is the first step in the loop

  • `{{for.last}}` A boolean indicating whether this is the last step in the loop

  • `{{for.even}}` A boolean indicating whether this is an even row in the loop

  • `{{for.odd}}` A boolean indicating whether this is an odd row in the loop


 click here for more details


Extracting Nupkg files using command line

Rename it to zip first then extract files as below 1.     Rename-Item -Path A_Package.nupkg -NewName A_Package.zip 2.     Make sure to repla...