All Questions
49 questions
2
votes
1
answer
73
views
How to Make an Image Field Non-Editable in Sitecore Experience Editor?
We are working on Sitecore 10.4 and using edit frames to make components editable with complex fields. However, I want to avoid making each field editable separately.
For simple fields like the title, ...
2
votes
2
answers
86
views
How to get random 3 data from list of datasource item using scriban template
How to get random 3 data from a list of data source items using the Scriban template below query, I can get all data and show accordingly but I need random 3 data from a list of data sources.
<div ...
2
votes
3
answers
187
views
Sitecore Scriban is not rendering fields when using dynamic field values
I have this Scriban template:
{{
mediaId = sc_field i_item 'DropLinkField'
item_By_Id = (sc_getitem mediaId)
item_harcoded = "{ADAF43DF-BFD6-4444-9FE9-A030AB70B873}"
get_the_url = ...
1
vote
2
answers
141
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">
...
0
votes
1
answer
101
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 ( ...
0
votes
2
answers
214
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=&...
0
votes
0
answers
56
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. ...
1
vote
1
answer
127
views
Explanation of the 'JSON Template' within SXAs 'JSON Variants'
I am currently struggling 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 variant....
1
vote
1
answer
88
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 ?
2
votes
1
answer
266
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?
2
votes
2
answers
2k
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?
1
vote
1
answer
562
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 ...
0
votes
1
answer
311
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 ...
1
vote
2
answers
446
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 ...
2
votes
1
answer
195
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: ...
1
vote
1
answer
575
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 ...
2
votes
1
answer
474
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 ...
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 ...
1
vote
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 ...
0
votes
1
answer
569
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?
1
vote
1
answer
233
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 ...
0
votes
2
answers
916
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.
&...
1
vote
2
answers
1k
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 ...
2
votes
1
answer
368
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 ...
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 ...
1
vote
0
answers
52
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 ...
1
vote
3
answers
972
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 ...
0
votes
1
answer
1k
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....
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 ...
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,\...
2
votes
1
answer
372
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 ...
1
vote
2
answers
742
views
Sitecore container with variants to change background color
I want 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 ...
0
votes
1
answer
424
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 ...
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=&...
2
votes
1
answer
874
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 ...
3
votes
1
answer
656
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/...
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 "...
0
votes
1
answer
307
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 ...
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 (...
2
votes
3
answers
645
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 ...
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 }}
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....
1
vote
1
answer
5k
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>
...
5
votes
1
answer
2k
views
Using Model in Scriban template
Is it possible to use the current Model in Scriban?
I have a CutomHeroViewModel
public class CustomHeroViewModel : VariantsRenderingModel
{
public string HeroTitle { get; set; }
public string ...
1
vote
0
answers
227
views
Is there a way to access all of a page's components?
I want to create a custom scriban Processor and I need to access all of the renderings that have been put on the page. Is there a way to access that data?
2
votes
1
answer
592
views
Customize Link rendering variant to append query string parameters
I want to customize an SXA link component with a rendering variant that appends query string parameters to the link based on fields on the page item. I'm using a Scriban template something like this:
...
5
votes
2
answers
6k
views
Accessing Link Field Values in a Scriban Template
I am using a Scriban template in Sitecore 9.3 with SXA and am attempting to render a link field. While the sc_link function reliably generates the URL, I cannot seem to find a way to access any other ...
2
votes
1
answer
2k
views
Is there a way to get a user object in Scriban?
I was trying to display user information inside a Scriban template (SXA variant).
I managed to write a context function that gives me the full name of the user (or any profile property I put in ...
4
votes
1
answer
1k
views
How can I use Sitecore Rules in Scriban templates in SXA 9.3
In SXA 9.3 we have the possibility of using Scriban Templates. I wonder if there is a possibility to use Sitecore rules engine inside of those templates. Let say that I would like to render part of ...