SXA Health Check

Reading time ~2 minutes

Scan your SXA solutions and find out if there are no problems.

Introduction

I help people to solve their problems with SXA from time to time and I remember many cases when a small problem in one place (broken link) caused serious problems in another. It is impossible to figure out at first glance what is going on in cases like that.

I was thinking about something that could help diagnose problems on remote instances for a long time.

I already wrote some PowerShell scripts which I shared with the community to scan content and find problematic items.

Finally, I decided to do something more. I present you SXA Health Check

SXA Health Check

TL;DR

If you ever used PowerShell in SXA, you will know what to do, SXA Health Check

About

SXA Health Check is a PowerShell script.

Right. One big script (at least for now).

I know that installing things might be a problem for people, that’s why I’ve decided to keep it simple. You just have to copy, paste the latest version and run, that’s it.

SXA support

Right now it should work for SXA 1.4 and above. I don’t think I will try to support earlier versions.

I haven’t tested it yet on every version but it should work. If you find any problems I will be really grateful if you could raise an issue here.

Usage

Executing

  1. Go to SXA.HealthCheck repository
  2. Open the latest version of main.ps1
  3. Copy content to a clipboard
  4. Open PowerShell ISE (http://domain/sitecore/shell/Applications/PowerShell/PowerShellIse?sc_bw=1)
  5. Paste content from a clipboard
  6. Set Context item to your site (for example /sitecore/content/F/Validation/V). If you are not familiar with ISE you can read more here
  7. Execute script

Steps will be executed one by one and you will see continuous results on the console.

Once the whole procedure is done you will see List View with validation results

Reading results

There are 3 possible results of validation:

  • OK - you can celebrate, a validation step was successful,
  • Warning - something has been found but it is not considered as a serious problem (perhaps you are still configuring your site or you set something explicitly to work as a developer). Treat it as a good advice but remember to review results before you publish your site,
  • Error - steps with this type of result must be solved.

For Error and Warning you will see message in the 4th column. It describes the problem and suggests what you could do to solve it

Code

The script contains a collection of validation steps defined inside. Each validation step has a similar structure to this:

@{
    Title       = "Validation step name";
    Description = "Validation step description.";
    Version     = @{
        From = 1400; # SXA version from which step can be executed
        To   = "*";  # SXA version to which step can be executed
    };
    Script      = {
        # validation script content
    }
}

As you can see not every step will be executed if validated feature is not available on your SXA version.

Summary

It’s just a beginning.

There are not too many steps right now (only 10) but I defined a structure and now it will be easier to move forward.

Right now I want to write more steps. In the meantime, I will be thinking about some way to help people to solve problems. Either provide auto-fix solutions or detailed information about the particular problem (maybe external pages hosted on Github).

If you have interesting ideas on how I could make this tool better let me know on twitter @AlanPloc or slack @alan

Asset Optimizer configuration

Explanation of different configuration options of SXA Asset Optimizer Continue reading

Items as resources and Unicorn

Published on November 21, 2021

Sitecore Extensions version 3.4 released

Published on November 07, 2020