Skip to main content

Posts

Showing posts from November, 2020

Sitecore Scriban Templates – Custom Functions to the Recue

 So you jumped in head first into Scriban Templates with Sitecore.  And now you hit a wall because it doesn't do that one thing you could easily have completed in MVC forms with a controller.  Well, this is where you can build your own custom functions to work within Scriban templates.  Sitecore already provides a few of these at  https://doc.sitecore.com/developers/sxa/93/sitecore-experience-accelerator/en/the-embedded-functions-for-the-scriban-template.html . So How Do You Build Your Own? Well let's begin by discussing what we want to build.  In our project we have a need to get the nearest parent of a certain template type.  This way we can determine if the page you are viewing is part of a conference section or not.   So first, let's build the C# code that will execute when we call the function.  We decided to add a new member to the i_item to determine if we were in a conference context and allow us to call other properties as we would need. public class GetConferenceC

Quick Tip - Scriban Date Formatting in Sitecore

 With the Scriban syntax being new to the Sitecore platform with v9.3 there is definitely a learning curve but well worth the time investment.  So we will post short tips on things that we struggled with.  This is to share but also I will have a place to find it again when I need it. So you've created a date field in your Sitecore template and now need to format it for display purposes.  Or even better, you have styling differences depending on if the dates and years match for start and end points.  Let's show this below. First, get the date(s) in your Scriban template from the item.  In this scenario I was looping through child objects called i_child.  Using the Scriban date.parse function I can get the date value from the Sitecore field by this:     {{         this.startDate = sc_field i_child 'Event Start' | date.parse;         this.endDate = sc_field i_child 'Event End' | date.parse;     }} Now that we have the date values you can do things to check against

Sitecore 9.3 – Scriban Templates – Yes Please!

 This feature sold us on our migration to Sitecore v9.3 and using SXA.  Why was it so important in our decision?  Based purely on speed to implement.  Let's explain, but first what is Scriban? What is a Scriban Template in Sitecore? Scriban is a fast, powerful, safe and lightweight scripting language and engine for .NET, which was primarily developed for text templating with a compatibility mode for parsing liquid templates. And Sitecore SXA has has adopted this new templating system whole-heartedly.  It allows a lot of your custom HTML and MVC controls to brought into the content tree.  Why is this important?  Because now you don't have to create a custom controller and CSHTML to create a rendering.  You can create and use a Scriban template. For more information refer to the documentation found at  https://doc.sitecore.com/developers/sxa/93/sitecore-experience-accelerator/en/scriban-templates.html .  You can also find more documentation on the Scriban template itself at  htt

Sitecore Experience Accelerator (SXA) – Why / Why Not?

So you have heard about Sitecore Experience Accelerator (SXA) and are debating if it is for you and your project.  First what is SXA and why should I be interested.  SXA is just what it sounds like.  Sitecore has built a framework on top of their Sitecore platform that adds some of the basic templates that allows you to focus on your value-add features faster.  What?!?  Let's take a look at this image to help explain. SXA out of the box does a great job of separating the areas of concern when building your site that make logic sense.  With the User Experience driving your efforts, SXA allows you to have parallel work streams in the Back-End vs the Front-End vs the Visual Design.  To learn more visit the Sitecore SXA documentation at  https://doc.sitecore.com/users/sxa/17/sitecore-experience-accelerator/en/introducing-sitecore-experience-accelerator.html . With SXA you can: Accelerate the delivery of sites using standard functionality with minimum-to-no CMS development. Enable diffe

Our Sitecore Adventure - Laying the Groundwork

 To set the tone for future postings I felt it best to lay the groundwork of what got us here and where we are headed.  First, I was brought into a project in December 2019 to take over an existing Sitecore implementation for a large active community of technical professionals.  Second, the team that implemented the website was an agency that was removed from the project as it began to spiral out of control.  Third, the current team supporting the site was newer to Sitecore and was keeping the lights on to make marketing deadlines.  Not trying to throw anyone under the bus but things were not in great shape walking into this project.  And on top of that we had a major conference with a set date and it wasn't moving, so not a lot of time to make huge changes right off the bat. So we patched up the servers, optimized SQL and IIS best we could and ran with the code base we had.  We found several surprises during the conference where assumptions were made based on the implementation te

The Sitecore Adventure Begins

 To be honest, my Sitecore adventure started a long time ago.  But now its time to share my adventure with you.  A little about who I am and what you can expect during this adventure. So Who am I? My name is Patrick Liekhus and I have been working within the software stacks for over 25 years now.  My background has been through most things .NET where I built a lot of custom software, however there was always one driving force.  You must find a way to add value and not just write code.  At the end of the day users typically don’t care what language you wrote your features in nor how well formatted your code looks.  They care about whether or not your solution fixes their problem.  And does it do so efficiently?  With that guiding light my teams have always focused on how we can utilize existing tools and frameworks to get the most value to the business as quickly as possible.  And doing so in a structured way that allows us to maintain and adjust the code as we learn more. So how does t

So You’ve Just Inherited THAT Project – OH NO!!

So your boss just gave you a new project you didn’t create, or you just started a new role and “didn’t know it was this bad".  Let’s be honest not all projects are new green field projects where we get to make all the decisions.  Sometimes we have to roll up our sleeves and get to work to make it happen.  At the end of the day our users typically care more about how your functionality fixes their problem and not what new language you wrote it in.  So let’s focus on some techniques over language patterns to help solve your problems. In my experiences with Sitecore implementations you never know what you are walking into with each project.  Nor should you care. When you are going through the code just remember this guiding principle – “Don’t Leave Broken Windows.” What?!? I thought we were writing code.  We are but let’s break this down for a minute.  If you haven’t heard of the Pragmatic Programmer book by Andrew Hunt and David Thomas I suggest you find a copy.  You can find one at