Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [scriban]

For questions related to the SXA Scriban templates.

Filter by
Sorted by
Tagged with
1 vote
2 answers
64 views

How can i get data index for accordion using scriban sxa [duplicate]

I am trying to get data index for accordion items using scriban in sitecore sxa. Below is my scriban code. <div class="accordion accordion-flush" id="accordionFlushExample"> ...
Gagan's user avatar
  • 45
0 votes
1 answer
41 views

Using sc_link_info on Scriban template throwing error

I am new to Sitecore sxa, I have got SXA Scriban template being used in rendering variant. as /Component-x/default/Link and this Link has a field where following snippet is provided. {{ if ( ...
Raunak Basnet's user avatar
0 votes
2 answers
124 views

how can we get general link field from rendering parameter in sitecore sxa using scriban

I am trying to access general link field from rendering parameter in sitecore sxa using scriban but it is accessing whole link tag with page id instead of url. how can get normal url? <a class=&...
Sharvan Gupta's user avatar
0 votes
1 answer
62 views

Can't read Tag title

I can't read tag title in scriban in sitecore while I can reach out the path and the display name correctly the code I use to read title: indTags = i_item.ProductIndustryTags.targets {{- for ind in ...
Sara Elgendy's user avatar
0 votes
0 answers
43 views

JSON template in Sitecore 10.1

Is there any alternate to JSON template in Sitecore 10.1?. We migrated to Sitecore 10.1 from Sitecore 8. One of the Rendering Variants is JSONResults, which includes JSON Template inside JSONResults. ...
Owais Ahmed's user avatar
1 vote
1 answer
109 views

Explanation of the 'JSON Template' within SXAs 'JSON Variants'

I am currently struggeling a bit with understanding the capabilities of the JSON Variants in SXA. We are on SXA 9.3 and I want to make some customizations to the JSON representation with a JSON ...
Simon's user avatar
  • 45
1 vote
1 answer
68 views

How to use a Static Binding in SXA Scriban

Is there a way to use a static Binding (View Rendering) in SXA Scriban Variant ?
Sylesh JL's user avatar
  • 179
1 vote
1 answer
206 views

Object reference not set to instance in preview mode for sc_translate

I am getting object reference not set to instance at sc_translate in preview mode When i checked the scriban loc (10,57), it is sc_translate What can be the possible reason for this?
Jagmeet Kaur's user avatar
2 votes
2 answers
1k views

Get Item by path or ID using Scriban in Sitecore

Environment: Sitecore 10.2 & SXA 10.2 Scenario: I would like to get the item by using its path or ID in Scriban. Is there any OOTB functionality to achieve this?
PSS's user avatar
  • 607
1 vote
1 answer
431 views

How to get 'Alt' field value of Sitecore media item by Sitecore Scriban embedded method?

I am able to get the Sitecore media link by using the Sitecore Scriban Embedded method as follows: <img src="{{sc_follow i_article 'Thumbnail'| sc_medialink}}"> But, not sure how to ...
Jumping Rabbit's user avatar
0 votes
1 answer
272 views

SXA component with rendering variant does not render if datasource is empty in the rendering

I am using an SXA component to render fields from current page. But it seems rendering variant renders fields only from datasource item. In my case, datasource is empty as I need to render fields from ...
Sitecoredev's user avatar
0 votes
2 answers
376 views

Facing error with SXA scriban template

I am trying to access the multilist field from datasource in scriban template and getting the following error. The code snippet is given below, <div class="row-section"> {{ for ...
manisha289's user avatar
2 votes
1 answer
176 views

Sitecore SXA Dynamic Placeholders

We are trying to render dynamic placeholders with Scriban as follows: {{ sc_placeholder "relatedcontainer*" }} On our UAT instance the placeholder expands the wildcard out properly: ...
Joe Ouimet's user avatar
2 votes
2 answers
430 views

How to render Sitecore Form using Sitecore Scriban Template

I need to render a Sitecore Form using the Sitecore Scriban Template. I see there is an implementation provided in Stack Exchange using MVC View. But is it possible using scriban?
Sitecore Learner's user avatar
1 vote
1 answer
450 views

Error when adding scriban template to rendering variant migrated from 9.1.1 to 10.2

I'm currently in the process of upgrading our solution from Sitecore 9.1.1 to 10.2. Our solution has a number of nVelocity templates that I need to replace with scriban templates. I've also already ...
soze's user avatar
  • 93
2 votes
1 answer
399 views

How to increment value and use it in sc_placeholder

Is it possible in Scriban to use the value from the variable, and then increment it and then use that value inside the sc_placeholder If it is not possible using the basic default Scriban, maybe ...
Samke11's user avatar
  • 359
0 votes
2 answers
468 views

How to have dynamic placeholders within the for loop?

I am trying to make the dynamic placeholders with different numbers in the for loop. Now when I make the placeholder I only get the same name and number at the end (test-1-1). How to make it so that ...
Samke11's user avatar
  • 359
0 votes
0 answers
27 views

How to check the length of selected items in for loop using Scriban? [duplicate]

Is there a way to check how many items are selected from Treelist using Scriban? What I want to do is that if there is only one item selected then display something, if there is more than two then ...
Samke11's user avatar
  • 359
0 votes
2 answers
2k views

Scriban Rendering Parameters - how to get the value from Droplist?

I am trying to get the value from the Rendering Parameters in Scriban in order to render some new logic. Basically, I want to allow the content editors to choose what colour of the button they will ...
Samke11's user avatar
  • 359
0 votes
1 answer
495 views

How to form a Page URL of wildcard item in scriban

I have created a variant to list down data source items using result variant selector and all these data items will need to point to wildcard content item .How to form URL of wildcard item in Scriban?
sonia yadav's user avatar
0 votes
1 answer
4k views

Scriban - How to check if the value of certain general link field is null [duplicate]

Is there any way to check if the value of a field is empty or to be more precise value in general link field is empty in Scriban? Whenever I type the if keyword, it does not register it: Here is the ...
Samke11's user avatar
  • 359
5 votes
1 answer
2k views

How can I do more complex loops in my Scriban templates?

I can loop through children like this: {{ for i_child in i_datasource.children}} But what if I only want the first 2, or if I want to skip the first 2 and take the next 3? Is this possible in scriban?...
Richard Seal's user avatar
  • 20.5k
1 vote
1 answer
166 views

Is there any way to edit partial design using Scriban?

Is it possible to style the partial design using the scriban template. For example, I just made the new header partial design for my new site, and I am now clueless on how to style it. I have been ...
Samke11's user avatar
  • 359
0 votes
2 answers
766 views

Using Sitecore link Manager in scriban script

I have a general link that is linking to an item in Sitecore. Path to linked item --> /sitecore/content/home/pageItemWithLayout I am using the below scriban script below to render the item link. &...
Shaurya's user avatar
  • 457
1 vote
2 answers
886 views

How to use orderby in Scriban template?

I have to list my upcoming events on the web page. I have created the data source item for holding all the events and each event has event date. I'm using Scriban to display all the events. My ...
arul pushpam's user avatar
2 votes
1 answer
327 views

Disable webedit for sc_field in Scriban?

I have a multi-line text field that I am rendering using scriban. the Field Content is an address some building, some floor some street PO box somePOboxNumber somecountry How can I render this field ...
Shaurya's user avatar
  • 457
1 vote
1 answer
1k views

Is there a way to render scriban templates without the use of SXA Rendering Variants?

I would like to do some quick prototyping of scriban templates but have found constantly changing the rendering variant and refresh the page to be more time consuming than I would like. Is there a ...
Michael West's user avatar
  • 18.2k
1 vote
0 answers
34 views

Difference between scriban import and add

we are currently building a foundation in Sitecore SXA to process the external data using scriban context. Since we are to new scriban world and tried to understand how scriban processors are adding ...
user3774739's user avatar
1 vote
3 answers
786 views

SXA Scriban Dynamic Placeholders

I am trying to render a dynamic placeholder with the Scriban as follows: {{ sc_placeholder 'section' }} and I would expect it to add a number to the key i.e. section-3, etc, but this is what I see as ...
Andrey Bobrov's user avatar
0 votes
1 answer
886 views

Search Result Listing Get index of an item using Scriban

I have a Search Result Listing Variant created using Scriban. This will render a card from each of the items got from the scope query. However, I want to get the index of items at the scriban template....
keysl's user avatar
  • 155
1 vote
1 answer
644 views

How to link static image asset from SXA using scriban

Sorry this is probably a dumb question but I can't seem to find anything related to it in google. Basically, I have a static image asset in my SXA Extension theme. e.g /sitecore/media library/...
keysl's user avatar
  • 155
4 votes
1 answer
1k views

How do you get value of item tag in scriban template

Sorry this is probably a dumb question but I am a bit stuck in here and I can't find suitable solutions in google. Basically I have an item or a page with a Tagging on it. But I can't seem to get the ...
keysl's user avatar
  • 155
4 votes
1 answer
2k views

Is there a way to parse Sitecore DateTime field type value in a particular Date or Time format directly in Scriban?

We are using SXA Rendering Variants with Scriban for our websites. In order to format the value of Sitecore field type DateTime in Scriban I am using `{{ sc_field i_item 'Date' [ [ 'format', 'd\nM,\...
Chetan Utture's user avatar
2 votes
1 answer
308 views

Handling multiple language versions of an Item in Scriban

Let's imagine I have an item with in three language versions: en, jp and es. My goal is to render a block which will display all 3 language versions of the item's 'Description' field. So, I would go ...
Andrey Bobrov's user avatar
0 votes
2 answers
654 views

Sitecore container with variants to change background color

I'd like to build a component in Sitecore that I can drag other components into when using Experience Accelerator, just like the out of the box container component. I'd also like to add variants on ...
natg504's user avatar
  • 15
0 votes
1 answer
385 views

Apply a CSS class to every alternative div using Sitecore SXA

I need to create an SXA component in which I need to apply a specific CSS class to each alternative div. The component should read the item from a multi-list and then render the HTML and apply a ...
Renuka's user avatar
  • 185
4 votes
1 answer
1k views

How do you detect Edit Mode in the Experience Editor with Scriban?

Is there a function that I can use in the Scriban template to implement conditional logic based on the fact that the page is opened in the Experience Editor? Something like the below: <div class=&...
Andrey Bobrov's user avatar
3 votes
2 answers
4k views

Scriban template split string

I have a pipe-separated string www.test.com | www.test1.com I want to get just the first string before the pipe that is www.test.com. How can I do this in the scriban template?
user avatar
1 vote
1 answer
3k views

How can I iterate through a list of links with Scriban?

I've created a template in Sitecore, and one of the fields in my template allows me to select an existing Link List item. I also have a Scriban variant where the code loops through all the items ...
natg504's user avatar
  • 15
2 votes
1 answer
729 views

Is there a way to do Scriban partial templates?

In MVC there's the concept of Partial Views which helps refactor common code that can be reused by other Views. Is there a similar concept in SXA Scriban? Ideal example: List of Links Template: {{ for ...
Mark Gibbons's user avatar
  • 5,632
0 votes
1 answer
833 views

Where can I find Scriban training or examples?

I'm trying to learn the basics of how to use Scriban to customize Sitecore SXA components. I'm having trouble finding any complete walk-throughs or training that provides a full example start to ...
natg504's user avatar
  • 15
3 votes
1 answer
573 views

Pipe expression destination `string.empty` is not a valid function

I'm trying to do something like {{ "" | string.empty }} and get Pipe expression destination 'string.empty' is not a valid function I can see it is available here though https://github.com/...
Mark Gibbons's user avatar
  • 5,632
1 vote
1 answer
1k views

Sitecore scriban how to fetch linked item from it's linked sub item?

I have a requirement to fetch the linked item from its linked sub item along with some linked item from the parent item's field. Below is the scenario. I have a "Landing Page" In the "...
Jey's user avatar
  • 343
0 votes
1 answer
242 views

Re-use the scriban template

Is there a way we can reuse a scriban template? I have a PromoBlock scriban template and I need to re-use that in the PromoHero and apply the Css Class to make it behave differently This is the ...
user avatar
1 vote
1 answer
1k views

Retrieving the href value of a Link field of Link item in scriban [duplicate]

I am trying to read the url value of Link field of Link item, append it with a query string and render the same as link. Below scriban does not work for the same. Any help please? {{ for i_child in (...
Christopher Raja's user avatar
2 votes
3 answers
589 views

Sitecore SXA search result count in scriban

Is there a way to read the search results count in a Scriban template in a rendering variant of SearchResult in SXA? I have a requirement that if the search results count is less than 6 the result ...
Christopher Raja's user avatar
2 votes
1 answer
2k views

How do you count the number of children in a Scriban template?

Given a page or item, how do I count the number of children? {{ i_page.children }}
Michael West's user avatar
  • 18.2k
2 votes
1 answer
1k views

How to get Media URL with custom width and media protection hash using Scriban

I need separate image fields for mobile and desktop and trying to render it using Scriban in picture tag as below. Current Scriban code: <picture> <source srcset="{{ i_item....
Harsh Baid's user avatar
  • 1,994
0 votes
1 answer
357 views

DisableWebEdit in a Scriban template

Is there a way we can use DisableWebEdit=true in a Scriban template?. Like on a cshtml page we can use <title>@Html.Sitecore().Field("Title", Sitecore.Context.Item, new { ...
user avatar
1 vote
1 answer
4k views

Null checks in Scriban

I want to check for null values in Scriban. {{ if (o_model.address.id) }} <div style="text-align: center;"><h5>Address {{ o_model.address.id}}</h5><br /></div> ...
user avatar