Monday, 5 April 2021

Enable and configure the Asset Optimizer in SXA - how to fix min files loading issue

  • Enable the Asset Optimizer globally

    To enable the optimizer globally: In the Content Editor, navigate to /sitecore/system/Settings/Foundation/Experience Accelerator/Theming/Optimiser and for both Scripts and Styles select Concatenate and Minify to minify all files and concatenate them into one file. Note Changes take effect immediately after the item is saved. Anonymous users might not see the changes until you publish. If you are using ES6, this back-end optimization is not compatible. Instead, use ECMAScript 6+.
  • Change the optimization settings for a specific site

    To change the optimization settings for a specific site: In the Content Editor, navigate to sitecore/content/Tenant/Site/Presentation/Page Designs. In the Asset Optimization section, in the Styles Optimizing Enabled and Scripts Optimizing Enabled fields, to override styles and scripts optimization settings, select: Default – to inherit global settings Yes – to always enable optimization for this site. No – to always disable optimization for this site.

Tuesday, 16 March 2021

Access Link Field values in Scriban

 

sc_field i_item 'LinkField' [['aria-label', (i_item.LinkField
.Title.raw)], ['class', 'btn btn-orange'], ['role', 'button']]

Thursday, 14 January 2021

Sitecore | SXA | Access Drop link and link field items in Scribban

  • Droplist type     

    • {{sc_raw i_item "fieldName"}}"
  • Droplink (one child item) 
  •  We can get the item and then read value from child item: 
    • {{- childitem=sc_follow i_item "fieldName" -}} 
    • {{sc_raw childitem "childItemfieldName"}}"
  • we can read Inline with the below:
    • {{sc_follow i_item "fieldName" | sc_raw "childItemfieldName"}}
  • Tree link (multiple sub child items) 
  • We can get all items as a collection
    • {{for i_child in (sc_followmany i_item "fieldName") }}.

Thursday, 17 December 2020

How to create new custom theme SXA Sitecore

1. Open website local root on your local machine and open the route C:\inetpub\wwwroot\sc93sc.dev.local\App_Config\Include\z.Feature.Overrides and enable config file.. 2. Navigate to folder under theme created on Local machinne and open command terminal on Visual studio code and run: 'npm config set `@sxa:registry https://sitecore.myget.org/F/sc-npm-packages/npm' 3. After registering nuget packages url, on the same root run : 'npm install -global @sxa/CLI' 4. Run this command to allow remote machine url to register url: 'Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine' I ran this on my local machine 5. And then run this command to register url: sxa register https://sc93.sc.local/ ((""Inorder to create a new theme we need to run 'new "Themename"' after above command on theme folder)) 6. Navigate actual theme location folder (C:\repos\CustomappTheme\-\media\Themes\Corporate\Customapp\COMBank> npm install) and run : 'npm install' This will install all required npm modules to our theme 7. Run this command on above root : 'SXA rebuild' 8. And then run gulp on the same root : 'gulp' 9. Command to run to publish UI changes to Sitecore Instance : 'sxa watch All -d' New setup for CE: master sitecore 7 but no need to run gulp sxa rebuld . Navigate actual theme location theme folder (Customapp> npm install) and run : 'npm install' This will install all required npm modules to our theme . Run this command on above root : 'SXA rebuild' . Command to run to publish UI changes to Sitecore Instance : 'sxa watch All -d'

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...