Questions tagged [scriban]
For questions related to the SXA Scriban templates.
13
questions
1
vote
1answer
23 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
1answer
33 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
1answer
28 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
1answer
130 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 }}
1
vote
1answer
91 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....
0
votes
1answer
41 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 { ...
0
votes
1answer
283 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>
...
2
votes
1answer
233 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
0answers
58 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?
1
vote
1answer
123 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:
...
3
votes
2answers
841 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
1answer
349 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 ...
3
votes
1answer
348 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 ...