Thursday, May 16, 2019

Donut Caching with Custom SXA Components

In this article Michael shares how to make your custom components, built for SXA, support the donut caching feature.

Today we discovered that one of the forms on our site would simply refresh as you hit the submit button. Further investigation revealed that this component was added to the Sitecore cache. Whenever we cleared the cache the component worked as expected, once. Oh no!

The fantastical SXA module supports donut caching which is made visible through a checkbox on the rendering parameters.

Donut caching setting on the Page List component
This setting is added on the rendering parameters template. Not sure which rendering parameter template is used? You can check it out on the component defined under Layouts.

If you navigate to that item you'll see under the template inheritance a base template for caching.

If you wish to add support for this capability just add the template to your custom rendering parameters template.

At the time of this article, the template ID is {6DA8A00F-473E-487D-BEFE-6834350D5B67} and can be easily added in the Raw values mode of the Content Editor.

Note: When cloning components you will probably use the rendering parameters template included with the original component, in which case you don't even have to do anything special.

If you enjoy using SXA and what to share your appreciation to the team or have questions be sure to check out the #sxa channel on Sitecore Chat.

Thursday, December 27, 2018

Sitecore Security for SXA Projects

Every new website requires some level of security configuration before launch. In this article we see one possible solution to applying security to sites built with the Sitecore Experience Accelerator (SXA).

Please note that the following scripts were written before the SXA module included scripts to manage security. I encourage you to evaluate those included out-of-the-box.

Role Configuration

Let's have a look at how the security will be setup for each tenant.

  • Each tenant will be organized by the company name. Companies have their own domain.
  • At least three of the six roles exist for all tenants (Admin, Editor, Developer). Each role inherits from a Base role (Sitecore Client Authoring, Sitecore Client Users) so they can login and manage content.
Tenant roles mapped to Sitecore roles
Running the script will present the user with a dialog like the following:

Dialog before security settings are applied
The dialog lists all of the available SXA tenants as well as any additional domains configured using the switching provider. This can be very helpful when using the Active Directory module because those users are not in the same domain as the tenant.

Show ribbon button using rules

Script Highlights

Let's walkthrough what changes are applied by the script.

Results output after completion
  • Site - Admin role granted access to help cleanup after users.
  • Home - Base role granted access to manage content.
  • Overlay - Admin role allowed to manage overlay content.
  • Data - Base role granted access to manage grandchildren. Prevents users from deleting global folders.
  • Media - Base role granted access to manage available media library folders.
  • Media Library - Base role granted access to manage media for this site.
  • Presentation - Developer role granted access to manage Rendering Variants, Partial Designs, etc.
  • Theme - Developer role granted access to manage media for this theme.
  • Data Templates - Developer role granted access to manage data templates.
  • Publishing Targets - Editor role granted access to publish to any target.
  • Languages - Everyone role granted access to read/write to all languages. This includes the tenant domain and additional domains selected.
  • System Settings - Developer role granted access to manage Modules, Settings, Tasks, and Workflows.
This will of course not cover the granularity that your company requires, but should provide you with a framework for crafting a tool for your own needs.

Hope this inspires you to build something great and share with the community.

The Scripts

Tuesday, November 20, 2018

Thank You Community Leaders 2018

Another year to be thankful. There are so many people in the community that I learned from this past year. I appreciate the time and energy they invest into me and others that I thought recognizing them would be appropriate.

My wife and I celebrated the birth of our first baby (Bella). Was so awesome to be gifted with a baby onsie for Bella. She loved it!

Community Members

Below are some people I had the opportunity to learn more about this year.

  • Corey Smith - I really enjoy talking with this smart guy about Sitecore and SXA. I recall a phone call we once had about something I had been working on; so encouraging to hear his feedback. He too shared some really cool things with me and the community. His contributions to JSS have been phenomenal. One time he even shaved his mustache off for the benefit of a beloved community member. I look forward to seeing him succeed in 2019. 
    No mustache.
  • Una Verhoeven - What a renaissance woman! She achieved just about all the community badges possible in 2018. Exciting that she was honored with the MVP award this year. I look forward to hearing about her new job in 2019 and celebrating her new achievements. 
    Enjoying her vacation, not thinking about work.
  • Saad Ansari - Sitecore Sam has been so helpful this year. Nice to see someone invest time in crafting quality blog posts (with nice imagery). Always finds an opportunity to help answer questions. What a great future MVP. 
    Actual photo of Saad.
  • Neil Shack - One of the best examples of a generous person. He was handing out this super cool book of Sitecore tips like it was candy. So good. Was great getting to visit with him again at the Sitecore Symposium. Not a bad housemate either!
    Thomas holding the book. Neil on the right.
Some other community members that I appreciate were shared in this previous post. Please read about it and tell them how much of a positive impact they had on you.

Final Thoughts

I encourage you to show your appreciation for those that have really helped you. Consider recommending those same people for Sitecore MVP. Also, try not to DM those people on Slack for support; stick to the group channels and only shift to the DM when they invite you to do so.

Monday, November 5, 2018

Override SXA Environment Site Resolver

In this very short post I demonstrate how to override the EnvironmentSiteResolver included with SXA to remove the use of fast queries.

This was tested on Sitecore 8.2.7 and SXA 1.7.0. Most of this is copied from the SXA library Sitecore.XA.Foundation.Multisite. I changed ResolveAllSites to call the local function GetContentItemsOfTemplate instead of the extension method. Then GetContentItemsOfTemplate calls the link database for items.

Thank you to my friend Corey Smith for his help in cleaning up the copy/paste mess that was in my initial version.

Monday, August 27, 2018

Little Book of Sitecore PowerShell Tips

My friend Neil Shack released an excellent series of books that every Sitecore enthusiast should have entitled The Little Book of Sitecore Tips. I am honored to be a technical reviewer in the second edition and very much appreciate him giving me the opportunity. In this post I share details about how I would like to release a sister series called The Little Book of Sitecore PowerShell Tips.

The Vision

The Sitecore PowerShell Extensions module is an amazing add-on available for Sitecore. Those using it would agree that it provides incredible flexibility and opportunity for feature development. Even the documentation is amazing. The user base for SPE stretches around the globe, with each individual bringing a unique perspective.

Since the module is built by the community, I would like to give the community an opportunity to help build a book of their best tips and tricks.

The Mission

Before a book can be published there needs to be content. While I may have some experience with SPE, I don't have all the best ideas about what tips and tricks mean the most to new and seasoned users of the module. I'm requesting that anyone that has used the module submit their best tips.

I would like the best tips to be included in the book, with credit to the submitter on the same page as the tip. Just think, if you submit a great tip your name could be published in the book!

The Plan

Please follow this link to submit your ideas. Once I have enough I'll organize them by most creative and helpful. I appreciate your help. Let's built something awesome!

Here's a picture of Neil.

Neil Shack
Hi, this is Neil. Buy his books please. Thx.

Thursday, August 2, 2018

Sitecore Developer Trial License

The Sitecore Developer Trial Program was made available to .Net developers and students who do not have access to a customer or partner license with complimentary training. Here I share my story about how the Sitecore Community made an impact on my life and how the trial license can set you on a path for an even more amazing career.

My Story

Have you ever felt like there was something missing in your career? Perhaps something you could not quite put your finger on? I remember sitting at work, staring up at the ceiling, wondering… pondering whether the projects I worked on were satisfying and gave me a sense of fulfillment.

The three years prior had a gradual decline in things new, interesting, and challenging. Working as a developer it is too easy to become isolated, especially when you are the only person assigned on a project/working remote.

One morning I see a message arrive in my inbox stating that our company had access to a content management system, something I thought our company would never spend money on. At that time the Marketing Team managed the code deployments for the website; I'm sure you can image the problems that created. Surely a CMS could help change things; especially with a cool name like Sitecore.

Soon enough I was sent off to training in some fancy building that had a tiny deli. Most of the people in my class had already experienced Sitecore and were simply there for the certification. Little did I know the next 9 months would be the craziest and most rewarding time. Every day there was something new for me to learn.

In 2013 Sitecore Slack and Sitecore Stack Exchange did not exist, and no Dallas Sitecore user groups were organized. If I wanted to meet new people I had to start connecting with people that blogged or built open source modules. One day I stumbled across a little module on the Marketplace called Sitecore PowerShell Console, you may have heard of it. I had recently been diving deep into all things Windows PowerShell, and to see this module was such an exciting moment. I soon reached out to the genius behind it named Adam Najmanowicz. He's such a great guy and when I offered to make some contributions to the module he gladly accepted. As time went on my contributions to the module increased, as did my connection to the community.

Adam and Michael at Sitecore Symposium

My first Sitecore event was to the Sitecore SUGCON NA 2015. Akshay Sura helped make that event happen, and I'm very thankful that he did. Since then I've attended a few of the Sitecore Symposiums and Summits. These have been such memorable experiences, especially when the avatars you see every day come to life, with beards as large as their personalities.

Trial License

Something really exciting for me is to see new members join the community and build relationships.

Follow the link to signup for the Sitecore Developer Trial License. You get 60 days, which is a whole lot of time to learn and way more than other trials offer. You can apply for a second extension for another 60 days. Just think, in 4 months you could be well equipped to start a career as a Sitecore Developer! You should consider reading this post Getting Started Learning Sitecore as a starting point for your Sitecore journey. The Sitecore Developer Foundation eLearning is another free resource for you.

Here are some things you can explore with the trial license:

Sitecore 9

The newest version includes support for the newest Forms module and xConnect! Read more here on a summary following the 2017 Sitecore Symposium by Hammad; really nice and concise write up.

Sitecore Experience Accelerator (SXA)

Module for rapidly building websites with a ton of functionality included out of the box. I've really enjoyed working with the module. Even came up with some extensions for the community.

Sitecore JavaScript Services (JSS)

So much to love about JavaScript. The documentation site was even built using JSS!


Learn about how Sitecore recommends organizing solutions. This has forced me to rethink how I structure code and ensure I follow practices acceptable to other leaders in the community.

The trial license makes available features that even a Sitecore client may have not yet have access to.

Closing Thoughts

Crazy to think that it's been almost 3 years since Sitecore Slack was setup by my friend Akshay, now with more than 3800 members. Joining the Sitecore community has given new life to my career by helping me connect with an army of enthusiasts I would have not met otherwise. I hope by sharing my experiences you are encouraged to connect with others. At the end of the day, all that really matters are the relationships that you've built.

Wednesday, June 27, 2018

Sitecore Support May or May Not Have a GitHub Repo!

I heard from a little birdie that there may or may not be a repository of the git kind on the internet.

- Michael