SlideShare a Scribd company logo
1 of 38
#SitecoreVDD
#SitecoreVirtualDay
Presented by:
Gert Gullentops @Gatagordo
March 17, 2021
Scriban for SXA
with
unlimited potential
© 2021 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S.
All other brand names are the property of their respective owners.
#SitecoreVDD
#SitecoreVirtualDay
01
02
03
04
05
Rendering variants
Scriban
Context functions
Item members
Using (Sitecore) objects in Scriban
Agenda
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
Rendering variants
• The editor can change the look & feel of OOTB (or custom) components
• Change the css – e.g. color
 STYLES
• Change the html - e.g. table vs list, extra fields …
 VARIANTS
Rendering variants
let you display different appearances of the same rendering
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA variants
• Limit # to 10
• Clone component
• Use rules engine
• Provide a preview
• Think of your editors !
Best practices
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA Variants
• Try : play with the variants
• Try again (refactor)
• Read the f.. manual (docs) 
• Google  blogs
• Sitecore Slack & Sitecore StackExchange
How to learn?
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
Scriban
• Fast, powerful and lightweight text
templating engine
• Well documented
https://github.com/lunet-io/scriban
• SXA extensions available
https://doc.sitecore.com/developers/sxa/100/sitecore-experience-
accelerator/en/scriban-templates.html
Scriban
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
Scriban
• Introduced in v9.3
• Rendering variant child
• Can be used in combination with other types
• (More than) replacing Nvelocity
SXA & Scriban
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
• Items / Objects
• Functions
• Extensions on items and fields
• Own customizations possible
Scriban Extensions in SXA
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
• i_item i_page i_datasource …
• o_language o_context o_pagemode …
• o_model (external data)
Items / Objects
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
• sc_field sc_raw sc_link
• sc_follow sc_followmany sc_query
• sc_parameter (get a rendering parameter)
• …
• sc_execute (executes a rendering variant field located beneath the Scriban template – e.g. Responsive Image)
• sc_translate (gets translation from the SXA dictionary – new in 9.3)
Functions
<h2>{{ sc_follow i_item “Link” | sc_field “Title” }}</h2>
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
i_item.
• name display_name language …
• template_name …
• children parent …
• has_layout …
• url
• FieldName (sc_field)
Item extensions
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
i_item.Field.
• raw
• target(s) (sc_follow)
Field extensions
<h2>{{ i_item.Link.Title }}<h2>
<p>{{ i_item.Color.Title.raw }}</p>
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
• More control over the output
• Compatible with other variant children
Very flexibel
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
• Fast
• Lots of features with the SXA extensions
Very powerful
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
• Don’t drown yourself
• 1 page ≠ single Scriban template
• Maintainability
• KEEP IT SIMPLE
BUT …
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban
• Add our own functions
• Add our own item members
• Add our own objects
One step beyond…
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban - Context function
• IGenerateScribanContextProcessor
• <generateScribanContext> pipeline
https://ggullentops.blogspot.com/2019/11/custom-sxa-scriban-extensions.html
Context Function
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban - Context function
{{ sc_meow “Key” }}
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Item member
• GetScribanItemMember
• <getScribanItemMembers> pipeline
https://ggullentops.blogspot.com/2019/11/custom-sxa-scriban-extensions.html
Item member
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Item member
{{ i_item.updated }}
{{ i_page.updated }}
…
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects
• What if.. we want to show
“Hello {firstname} {lastname}” ?
• Add the User object to Scriban
(as SXA did with the Item object)
Thx @Dawid Rutkowski & Sitecore StackExchange 
https://ggullentops.blogspot.com/2020/03/extending-sitecore-scriban-user-object.html
Adding objects
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects
Scriban.Runtime.IObjectAccessor
• GetMembers
• TryGetValue
• ToString
1. Object Accessor
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects
• Return the names of all properties you want to expose 
all value typed properties of a users profile.
GetMembers
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects - Object Accessor
• Try to get the value for the given member from the object.
• The bool return value indicates whether the value was found or not
public bool TryGetValue(TemplateContext context, SourceSpan span, object target, string member, out object value)
TryGetValue
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects - Object Accessor
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects - Object Accessor
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects
• Register all accessors
• SitecoreTemplateContext
Sitecore.XA.Foundation.Scriban.ContextExtensions
2. Template Context
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects – Template Context
• Override SitecoreTemplateContext
• Constructor: initialize the Object Accessors
• GetMemberAccessorImpl: decide which Accessor to use (based on target type)
• ToString: decide which ToString method to use (based on target type)
Template Context
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects – Template Context
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects
• Processor to set template context
• generateScribanContext pipeline
• IGenerateScribanContextProcessor
Sitecore.XA.Foundation.Scriban.Pipelines.GenerateScribanContext
3. InitializeScriban Context
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects – InitializeScribanContext
InitializeScribanContext
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects – InitializeScribanContext
InitializeScribanContext
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
SXA & Scriban – Objects
Scriban template:
Usage
<div>
<ul>
{{for i_user in (sc_getusers)}}
<li>{{i_user}} - {{i_user.Email}} - {{i_user.Portrait}}</li>
{{end}}
</ul>
</div>
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
What did we learn today?
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
What did we learn
Variants are a powerful feature in SXA
Use variants to make the life of your editors easier
Use variants to make the life of your developers easier
Scriban adds even more flexibility and possibilities
Use Scriban – wisely
Write own Scriban extensions if needed
© 2021 Sitecore Corporation A/S.
#SitecoreVDD
#SitecoreVirtualDay
What did we learn about Scriban
Custom logic needed  create a Context Function
Access to extra (Sitecore) object needed  add an Object Accessor
Extra Item property needed  create an Item Member
Enjoy unlimited potential !
Keep it simple
#SitecoreVDD
#SitecoreVirtualDay
Today’s speaker
• Sitecore certified since 2006
• Sitecore MVP 2017-2021
Gert Gullentops
.NET developer – The Reference (Belgium)
ggullentops@reference.be
@Gatagordo
https://ggullentops.blogspot.com
FOR DISCUSSION PURPOSES ONLY.
Sitecore Confidential and Proprietary. ©2021 Sitecore
Corporation A/S. Sitecore® and Own the Experience® are
registered trademarks of Sitecore Corporation A/S. All other
brand names are the property of their respective owners.
#SitecoreVDD
#SitecoreVirtualDay

More Related Content

What's hot

Form Processing In Php
Form Processing In PhpForm Processing In Php
Form Processing In PhpHarit Kothari
 
Getting into HTML
Getting into HTMLGetting into HTML
Getting into HTMLispkosova
 
Classloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGiClassloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGimartinlippert
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basicsEliran Eliassy
 
Den första staten
Den första statenDen första staten
Den första statensofianilsson
 
HTML presentation for beginners
HTML presentation for beginnersHTML presentation for beginners
HTML presentation for beginnersjeroenvdmeer
 
Pretrazivanje na internetu 01
Pretrazivanje na internetu 01Pretrazivanje na internetu 01
Pretrazivanje na internetu 01Miroslav
 
Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Steve Guinan
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Languageguestceb98b
 
사업소개서 Ab180(공개버전)
사업소개서 Ab180(공개버전)사업소개서 Ab180(공개버전)
사업소개서 Ab180(공개버전)Sungpil Nam
 
The FPDF Library
The FPDF LibraryThe FPDF Library
The FPDF LibraryDave Ross
 

What's hot (20)

Vačnatci 1
Vačnatci 1Vačnatci 1
Vačnatci 1
 
HTML X CSS
HTML X CSSHTML X CSS
HTML X CSS
 
Robotika nova ti t
Robotika nova ti tRobotika nova ti t
Robotika nova ti t
 
Form Processing In Php
Form Processing In PhpForm Processing In Php
Form Processing In Php
 
Getting into HTML
Getting into HTMLGetting into HTML
Getting into HTML
 
Classloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGiClassloading and Type Visibility in OSGi
Classloading and Type Visibility in OSGi
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Comitology.pptx
Comitology.pptxComitology.pptx
Comitology.pptx
 
Den första staten
Den första statenDen första staten
Den första staten
 
Medienkompetenz
MedienkompetenzMedienkompetenz
Medienkompetenz
 
HTML presentation for beginners
HTML presentation for beginnersHTML presentation for beginners
HTML presentation for beginners
 
Dom
Dom Dom
Dom
 
Pretrazivanje na internetu 01
Pretrazivanje na internetu 01Pretrazivanje na internetu 01
Pretrazivanje na internetu 01
 
Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning
 
Css position
Css positionCss position
Css position
 
Forms Part 1
Forms Part 1Forms Part 1
Forms Part 1
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
사업소개서 Ab180(공개버전)
사업소개서 Ab180(공개버전)사업소개서 Ab180(공개버전)
사업소개서 Ab180(공개버전)
 
The FPDF Library
The FPDF LibraryThe FPDF Library
The FPDF Library
 
Html frames
Html framesHtml frames
Html frames
 

Similar to Scriban for SXA with unlimited potential

Sitecore User Group - JSS & GraphQL
Sitecore User Group - JSS & GraphQLSitecore User Group - JSS & GraphQL
Sitecore User Group - JSS & GraphQLThom Puiman
 
SUGCON ANZ 2022 Sitecore Personalize Technical.pptx
SUGCON ANZ 2022 Sitecore Personalize Technical.pptxSUGCON ANZ 2022 Sitecore Personalize Technical.pptx
SUGCON ANZ 2022 Sitecore Personalize Technical.pptxJitendra Soni
 
Verndale - Sitecore User Group Los Angeles Presentation
Verndale - Sitecore User Group Los Angeles PresentationVerndale - Sitecore User Group Los Angeles Presentation
Verndale - Sitecore User Group Los Angeles PresentationDavid Brown
 
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...VarunNehra
 
20180605 sso with apex and adfs the weblogic way
20180605 sso with apex and adfs the weblogic way20180605 sso with apex and adfs the weblogic way
20180605 sso with apex and adfs the weblogic waymakker_nl
 
Professional Services Insights into Improving Sitecore XP
Professional Services Insights into Improving Sitecore XPProfessional Services Insights into Improving Sitecore XP
Professional Services Insights into Improving Sitecore XPSeanHolmesby1
 
SUGCON-NA-Unleashing the full potential of XM Cloud personalization with Site...
SUGCON-NA-Unleashing the full potential of XM Cloud personalization with Site...SUGCON-NA-Unleashing the full potential of XM Cloud personalization with Site...
SUGCON-NA-Unleashing the full potential of XM Cloud personalization with Site...Rodrigo Peplau
 
Multilayered Personalization in Sitecore
Multilayered Personalization in SitecoreMultilayered Personalization in Sitecore
Multilayered Personalization in SitecoreRaman Gupta
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Peter Procházka
 
world's fastest delivery pipeline for Sitecore on Azure
world's fastest delivery pipeline for Sitecore on Azureworld's fastest delivery pipeline for Sitecore on Azure
world's fastest delivery pipeline for Sitecore on AzureBas Lijten
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Peter Procházka
 
Sitecore loves containers
Sitecore loves containersSitecore loves containers
Sitecore loves containersBart Plasmeijer
 
Salesforce Lightning Web Components Overview
Salesforce Lightning Web Components OverviewSalesforce Lightning Web Components Overview
Salesforce Lightning Web Components OverviewNagarjuna Kaipu
 
Bhadale Group of Companies - digital projects
Bhadale Group of Companies - digital projectsBhadale Group of Companies - digital projects
Bhadale Group of Companies - digital projectsVijayananda Mohire
 
Search - Sugcon 2023.pptx
Search - Sugcon 2023.pptxSearch - Sugcon 2023.pptx
Search - Sugcon 2023.pptxJesper Balle
 
Experience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackExperience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackJeffrey Rondeau
 

Similar to Scriban for SXA with unlimited potential (20)

Sitecore User Group - JSS & GraphQL
Sitecore User Group - JSS & GraphQLSitecore User Group - JSS & GraphQL
Sitecore User Group - JSS & GraphQL
 
SUGCON ANZ 2022 Sitecore Personalize Technical.pptx
SUGCON ANZ 2022 Sitecore Personalize Technical.pptxSUGCON ANZ 2022 Sitecore Personalize Technical.pptx
SUGCON ANZ 2022 Sitecore Personalize Technical.pptx
 
SXA beyond the box
SXA beyond the boxSXA beyond the box
SXA beyond the box
 
JAMStack
JAMStackJAMStack
JAMStack
 
Verndale - Sitecore User Group Los Angeles Presentation
Verndale - Sitecore User Group Los Angeles PresentationVerndale - Sitecore User Group Los Angeles Presentation
Verndale - Sitecore User Group Los Angeles Presentation
 
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
 
20180605 sso with apex and adfs the weblogic way
20180605 sso with apex and adfs the weblogic way20180605 sso with apex and adfs the weblogic way
20180605 sso with apex and adfs the weblogic way
 
Professional Services Insights into Improving Sitecore XP
Professional Services Insights into Improving Sitecore XPProfessional Services Insights into Improving Sitecore XP
Professional Services Insights into Improving Sitecore XP
 
SUGCON-NA-Unleashing the full potential of XM Cloud personalization with Site...
SUGCON-NA-Unleashing the full potential of XM Cloud personalization with Site...SUGCON-NA-Unleashing the full potential of XM Cloud personalization with Site...
SUGCON-NA-Unleashing the full potential of XM Cloud personalization with Site...
 
Multilayered Personalization in Sitecore
Multilayered Personalization in SitecoreMultilayered Personalization in Sitecore
Multilayered Personalization in Sitecore
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
 
world's fastest delivery pipeline for Sitecore on Azure
world's fastest delivery pipeline for Sitecore on Azureworld's fastest delivery pipeline for Sitecore on Azure
world's fastest delivery pipeline for Sitecore on Azure
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
 
Sug bangalore - headless jss
Sug bangalore - headless jssSug bangalore - headless jss
Sug bangalore - headless jss
 
Sitecore loves containers
Sitecore loves containersSitecore loves containers
Sitecore loves containers
 
Oracle APEX Nitro
Oracle APEX NitroOracle APEX Nitro
Oracle APEX Nitro
 
Salesforce Lightning Web Components Overview
Salesforce Lightning Web Components OverviewSalesforce Lightning Web Components Overview
Salesforce Lightning Web Components Overview
 
Bhadale Group of Companies - digital projects
Bhadale Group of Companies - digital projectsBhadale Group of Companies - digital projects
Bhadale Group of Companies - digital projects
 
Search - Sugcon 2023.pptx
Search - Sugcon 2023.pptxSearch - Sugcon 2023.pptx
Search - Sugcon 2023.pptx
 
Experience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackExperience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable Stack
 

Recently uploaded

Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...akbard9823
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewingbigorange77
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 

Recently uploaded (20)

Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewing
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 

Scriban for SXA with unlimited potential

  • 1. #SitecoreVDD #SitecoreVirtualDay Presented by: Gert Gullentops @Gatagordo March 17, 2021 Scriban for SXA with unlimited potential
  • 2. © 2021 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. #SitecoreVDD #SitecoreVirtualDay 01 02 03 04 05 Rendering variants Scriban Context functions Item members Using (Sitecore) objects in Scriban Agenda
  • 3. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay Rendering variants • The editor can change the look & feel of OOTB (or custom) components • Change the css – e.g. color  STYLES • Change the html - e.g. table vs list, extra fields …  VARIANTS Rendering variants let you display different appearances of the same rendering
  • 4. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA variants • Limit # to 10 • Clone component • Use rules engine • Provide a preview • Think of your editors ! Best practices
  • 5. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA Variants • Try : play with the variants • Try again (refactor) • Read the f.. manual (docs)  • Google  blogs • Sitecore Slack & Sitecore StackExchange How to learn?
  • 6. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay Scriban • Fast, powerful and lightweight text templating engine • Well documented https://github.com/lunet-io/scriban • SXA extensions available https://doc.sitecore.com/developers/sxa/100/sitecore-experience- accelerator/en/scriban-templates.html Scriban
  • 7. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay Scriban • Introduced in v9.3 • Rendering variant child • Can be used in combination with other types • (More than) replacing Nvelocity SXA & Scriban
  • 8. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban • Items / Objects • Functions • Extensions on items and fields • Own customizations possible Scriban Extensions in SXA
  • 9. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban • i_item i_page i_datasource … • o_language o_context o_pagemode … • o_model (external data) Items / Objects
  • 10. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban • sc_field sc_raw sc_link • sc_follow sc_followmany sc_query • sc_parameter (get a rendering parameter) • … • sc_execute (executes a rendering variant field located beneath the Scriban template – e.g. Responsive Image) • sc_translate (gets translation from the SXA dictionary – new in 9.3) Functions <h2>{{ sc_follow i_item “Link” | sc_field “Title” }}</h2>
  • 11. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban i_item. • name display_name language … • template_name … • children parent … • has_layout … • url • FieldName (sc_field) Item extensions
  • 12. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban i_item.Field. • raw • target(s) (sc_follow) Field extensions <h2>{{ i_item.Link.Title }}<h2> <p>{{ i_item.Color.Title.raw }}</p>
  • 13. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban • More control over the output • Compatible with other variant children Very flexibel
  • 14. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban • Fast • Lots of features with the SXA extensions Very powerful
  • 15. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban • Don’t drown yourself • 1 page ≠ single Scriban template • Maintainability • KEEP IT SIMPLE BUT …
  • 16. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban • Add our own functions • Add our own item members • Add our own objects One step beyond…
  • 17. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban - Context function • IGenerateScribanContextProcessor • <generateScribanContext> pipeline https://ggullentops.blogspot.com/2019/11/custom-sxa-scriban-extensions.html Context Function
  • 18. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban - Context function {{ sc_meow “Key” }}
  • 19. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Item member • GetScribanItemMember • <getScribanItemMembers> pipeline https://ggullentops.blogspot.com/2019/11/custom-sxa-scriban-extensions.html Item member
  • 20. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Item member {{ i_item.updated }} {{ i_page.updated }} …
  • 21. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects • What if.. we want to show “Hello {firstname} {lastname}” ? • Add the User object to Scriban (as SXA did with the Item object) Thx @Dawid Rutkowski & Sitecore StackExchange  https://ggullentops.blogspot.com/2020/03/extending-sitecore-scriban-user-object.html Adding objects
  • 22. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects Scriban.Runtime.IObjectAccessor • GetMembers • TryGetValue • ToString 1. Object Accessor
  • 23. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects • Return the names of all properties you want to expose  all value typed properties of a users profile. GetMembers
  • 24. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects - Object Accessor • Try to get the value for the given member from the object. • The bool return value indicates whether the value was found or not public bool TryGetValue(TemplateContext context, SourceSpan span, object target, string member, out object value) TryGetValue
  • 25. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects - Object Accessor
  • 26. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects - Object Accessor
  • 27. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects • Register all accessors • SitecoreTemplateContext Sitecore.XA.Foundation.Scriban.ContextExtensions 2. Template Context
  • 28. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects – Template Context • Override SitecoreTemplateContext • Constructor: initialize the Object Accessors • GetMemberAccessorImpl: decide which Accessor to use (based on target type) • ToString: decide which ToString method to use (based on target type) Template Context
  • 29. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects – Template Context
  • 30. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects • Processor to set template context • generateScribanContext pipeline • IGenerateScribanContextProcessor Sitecore.XA.Foundation.Scriban.Pipelines.GenerateScribanContext 3. InitializeScriban Context
  • 31. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects – InitializeScribanContext InitializeScribanContext
  • 32. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects – InitializeScribanContext InitializeScribanContext
  • 33. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay SXA & Scriban – Objects Scriban template: Usage <div> <ul> {{for i_user in (sc_getusers)}} <li>{{i_user}} - {{i_user.Email}} - {{i_user.Portrait}}</li> {{end}} </ul> </div>
  • 34. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay What did we learn today?
  • 35. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay What did we learn Variants are a powerful feature in SXA Use variants to make the life of your editors easier Use variants to make the life of your developers easier Scriban adds even more flexibility and possibilities Use Scriban – wisely Write own Scriban extensions if needed
  • 36. © 2021 Sitecore Corporation A/S. #SitecoreVDD #SitecoreVirtualDay What did we learn about Scriban Custom logic needed  create a Context Function Access to extra (Sitecore) object needed  add an Object Accessor Extra Item property needed  create an Item Member Enjoy unlimited potential ! Keep it simple
  • 37. #SitecoreVDD #SitecoreVirtualDay Today’s speaker • Sitecore certified since 2006 • Sitecore MVP 2017-2021 Gert Gullentops .NET developer – The Reference (Belgium) ggullentops@reference.be @Gatagordo https://ggullentops.blogspot.com
  • 38. FOR DISCUSSION PURPOSES ONLY. Sitecore Confidential and Proprietary. ©2021 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. #SitecoreVDD #SitecoreVirtualDay

Editor's Notes

  1. Sc_field needed when space in the fieldname
  2. Think about your team members (and yourself)
  3. Inject Sitecore context – if needed Process  delegate : our custom logic  “sc_meow” (use Func instead of delegate) Config : resolve = true
  4. Item member = extension method on “item” Inject Sitecore context – if needed - Membername - Resolve function
  5. Scriban objects – not related to Sitecore yet
  6. Check is target is User Get properties and return name..
  7. Verify target. Get the property named "member" from the UserProfile type. Property is case sensitive! Get the value of that property from the given object (User) - in our case it's the user.Profile and not the user itself.
  8. This is SXA namespace
  9. This is SXA namespace
  10. sc_getusers = function to get users (or could be simple function to get the current User)  return User object from that function
  11. In order of likeliness to use them Keep your templates simple !!!