Dude Where's my Rendering Used

01 November 2020

SXA is an amazing addition to Sitecore, but page designs and partial designs can make it hard to see what pages use a particular rendering.

In vanilla Sitecore, select a rendering in the Content Editor, click Navigate > Links to show a list of items using that rendering.

In SXA this is more tricky because we have the following links between renderings and pages:

Page referencing a page design:

  1. Rendering
  2. Partial Design
  3. Page Design
  4. Page

Page linked to page design via Page Designs setting:

  1. Rendering
  2. Partial Design
  3. Page Design
  4. Page Designs
  5. Page Templates
  6. Pages

To get around this, I wrote a Sitecore PowerShell Extensions (SPE) script to help. You can find it on github here: https://gist.github.com/dresser/960d9943c3a8c9b17f0a36ca0839e6db

How to use the script

  1. Go to Sitecore Desktop
  2. Click PowerShell ISE
  3. Paste the script into the editor

Now you need to make a few edits to the script to make it work for your solution:

  1. Change $presentationPath to point to the "Presentation" folder of your site
  2. Change $metadataPartialDesignTemplateId to the ID for your solution - SXA solutions will often have numerous templates inherited from SXA foundation templates, your solution is likely to be using a derived template hence this ID needs to be updated. This template should inherit /sitecore/templates/Foundation/Experience Accelerator/Presentation/Metadata Partial Design
  3. Change $partialDesignTemplateId to the ID for your solution - the SXA Foundation template is /sitecore/templates/Foundation/Experience Accelerator/Presentation/Partial Design
  4. Change $pageDesignTemplateId to the ID for your solution - the SXA Foundation template is /sitecore/templates/Foundation/Experience Accelerator/Presentation/Page Design
  5. $homePagePath to the Home item path for your site

When you run the script you will be prompted "Enter the ID of a rendering:" here you simply paste the ID of the rendering you are looking for and then click OK. If the script found usages of the rendering, it will be displayed in an output table.

Hope this helps someone. Let me know in the comments section below if you have any problems or suggestions!

 

Next Article

Introducing my Polski Fiat 126p

Tags: SXAHelixSPE
comments powered by Disqus