Creating Preview / Draft Sites in SXA using SPE

A few weeks ago I was tasked with providing the ability for content editors to be able to have a preview (or draft) site for SXA sites when using the CM Url. The requirement was to be able to view ‘Draft’ content/versions of pages (without publishing them) for stakeholders to be able to preview them before they are published to the CD instance. In an Traditional Sitecore setup this is pretty easy, you would just edit the site definition config in the Sitecore config with a patch file to change the database used to Master when on the CM. For SXA this is a bit trickier as the Site definitions are dynamically built by SXAs site manager when Sitecore starts up (or the SXA Site Manager is ran again in Sitecore). However after reading around it seems it was possible to achieve what I needed to do. I had to … Continue reading Creating Preview / Draft Sites in SXA using SPE

Removing Unneeded Sitecore Versions with SPE

It’s been a while since I had to look how best to manage Sitecore versions, but after seeing some performance issues related to lots of versions for some items on the CM this week It was time to revisit removing unneeded Sitecore versions. Research Amusingly my search turned up an SSE post with an answer from myself from about 5 years ago: https://sitecore.stackexchange.com/questions/507/limiting-version-numbers-copying-old-versions-to-archive-for-easy-access/525 Further Googling shows not much seems to have changed in that time. Some modules are however no longer supported or are compatible with Sitecore 9. I did find some links that gave me a few ideas though. Our requirements were to find any items with more than 10 versions and then remove any versions other than the most recent ten unless an version is the currently published version or the version has been updated on the past 3 months. The idea behind this is that we wanted to remove … Continue reading Removing Unneeded Sitecore Versions with SPE

SUGCON 2022 Thoughts and Takeaways

It’s been 3 years Since the last ‘In-Person’ SUGCON in London 2019, so I was really looking forward to going to Budapest to learn some new Sitecore things and catch up with Sitecore Developers and friends from across the world. I’ve been to Budapest for a weekend once before and It’s a beautiful city. After a long flight with a change at Amsterdam I arrived at the Conference centre in Budapest pretty late but immediately bumped into a bunch of people I know from the Sitecore Community. After a drink in the bar it was time to hit the sack ready for the first day of SUGCON. Day 1. Steve Tzikakis – Opening Keynote There was a notable excitement in the room as Tamas opened up SUGCON to much applause welcomed everyone and introduced Steve Tzikakis to the stage. Steve seemed genuinely happy to be at SUGCON and have the opportunity to … Continue reading SUGCON 2022 Thoughts and Takeaways

Removing Unneeded Tags from RTE fields with Sitecore PowerShell Extensions

This week I had an issue where some items imported from another system into Sitecore had invalid HTML in some of their RTE fields. These tags were breaking the SXA page content component that was being used. I needed to a quick way to remove these tags without having to re-import the content. As usual SPE came to the rescue again and I was able to correct 100s of items in seconds. The script has a function which takes an item and field name as a parameter: Strip-InvalidTags -item $item -fieldName “Details” I’m getting a number of profile items and calling this function in a loop. The function uses HTMLAgilityPack to look for ‘Script’ tag nodes (but can easily be modified to pick up different tags or multiple tags). If the script finds the tags is strips them and then saves the modified html back to the field. Here is the … Continue reading Removing Unneeded Tags from RTE fields with Sitecore PowerShell Extensions

Sitecore Sloth Module 1.1 Released

A few weeks ago I wrote about how I updated Sloth to support Items as Resource files.  I’ve now got round to releasing this package on Nuget and creating Sitecore Packages for this too in case you want to install in that way instead. I’ve updated the Github readme with all the info too. Sloth 1.1 supports being able to enable and disable the module under the settings here: /sitecore/system/Modules/Sitecore Sloth. Please ensure you enable the module and save the item after installing version 1.1.             Installing Sloth 1.1 for Sitecore 10.1+ Via Nuget You can install version 1.1 of Sloth via Nuget like so if using Sitecore 10.1 or above: Install-Package FluxDigital.Foundation.Sloth -Version 1.1.0 I’ve tested installing the Nuget package for Sitecore 1.1 and if installed correctly you should see the following files:           I haven’t created a Sloth 1.1 Nuget … Continue reading Sitecore Sloth Module 1.1 Released

Creating Custom Item as Resources Files with Sitecore CLI 4.0

Back when Sitecore 10.1 was released in February Sitecore include a significant change to how the out of the box items were shipped with the release. They were no longer stored in the databases and instead are shipped as ‘items.x.dat’ files in the /App_Data/items folder. These files are in a new Protocol Buffers (ProtoBuf) format, referred to as ‘Items as Resources’ and make upgrades simpler. Jeremy has a really good over-view of this if you want to learn more about it. However until recently it was not possible to create your own custom ProtoBuf files to deploy your items as it wasn’t supported in Sitecore 10.1 or using Sitecore CLI 3.0. Sitecore CLI 4.0 was released at the end of September though and now includes a ‘Sitecore ResourcePackage plugin’ for doing this. Note: it is only possible to use Items as Resources with 10.1 and 10.2. TLDR Use Sitecore CLI 4.0 to … Continue reading Creating Custom Item as Resources Files with Sitecore CLI 4.0

Manchester Sitecore User Group – September 2021

Back in September I organised the first In-Person Sitecore user group in Manchester in over a year with help from Dom Hurst and Jeremy Davis. It was kindly hosted by Dept with the Talks on the Big Screen and was great to get everyone together again. We had 2 great talks and a debate session in the middle which I lead. It was a challenge to organise and promote given concerns around In-Person events. However we got around 25 attendees on the day, so all in all I think it was a success. I recorded the event but it’s taken me a while to pull the videos off my SLR as needed to find my adapter for my Mac and edit the videos together. I have finally done this though and you can now view the video of the SUG on YouTube. Apologies for the sound and video as they … Continue reading Manchester Sitecore User Group – September 2021

Sitecore Sloth Module

A while back Kamruz Jaman wrote about how to stop experience editor reloading the page when you make changes to components. Over the years I’ve added this improvement into a few Sites I’ve worked on in an upgrade-proof way and tweaked it a bit. It prevents the page scrolling back to the top when reloading when adding or editing components, changing datasources, rendering params or workflow. This still seems to be a frustration even in the latest version of Sitecore and as adding this improvement in involves a bit of code (and understanding of how to inject scripts into Sitecore Experience Editor) I decided it would be nice to package this up into a proper Sitecore module. Example of Experience Editor Issue You can see an example of this below with a simple Bootstrap 5 Site. When a Card components properties are edited in experience editor it scrolls the editor half way up the page when saving. Sloth Demo … Continue reading Sitecore Sloth Module

Installing SiteCron through NuGet and Configuring

Last week I needed to run a Job to perform a daily task within Sitecore so I decided that SiteCron would be the perfect fit for this. SiteCron allows you to run Jobs on a schedule within Sitecore using Cron expressions (under the hood it uses Quartz.NET). I’ve used SiteCron on 3 or 4 projects in the past and really like how reliable and configurable it is for these kind of requirements. Each time I install it though I forget the steps (especially if doing it via NuGet) so I thought I’d give an overview of this below, including the Unicorn config I used. Wait, where is the SiteCron version for Sitecore 9+? Unfortunately the latest version at the time was 3.4 which was compiled against .Net 4.5.2 for Sitecore 7 – 8.3. The client I was working with use Sitecore 9.3 which requires .Net 4.7.1. So I compiled a new version … Continue reading Installing SiteCron through NuGet and Configuring

Creating a Table Component for Sitecore

So not too long ago I had a requirement to create an Table component for a client. Before you shoot me down, I know this is generally a bad idea as the RTE in Sitecore has in-built support for Tables and there are Rich Snippets too. However there were a number of reasons that wouldn’t work well in this scenario, read on to find out why. But, but RTE!?               There were some specific requirements which couldn’t be met by the RTE or Rich Snippets fully, we needed to: Add some specific mark-up, classes and wrapping divs around the table (some of this was for responsive requirements). Enforce Table header, body and footer rows Reduce the options for cells and rows to control better what content editors can do (for consistency). Be able to update the table mark-up easily in the future (so Rich Snippets … Continue reading Creating a Table Component for Sitecore