Alan NULL - BlogJekyll2023-10-04T22:08:37+02:00https://alan-null.github.io/Alan Płócieniakhttps://alan-null.github.io/alan-null@outlook.comhttps://alan-null.github.io/2023/10/ao-optimized2023-10-04T00:00:00+02:002023-10-04T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>The post describes different configuration options of SXA Asset Optimizer and their influence on each other.<!--more--></p>
<h1 id="asset-optimizer-configuration">Asset Optimizer configuration</h1>
<p>Each row represents example configuration set and the end result. Some options have priority over the other.</p>
<ul>
<li><strong>Asset</strong> - contains cases that I wanted to highlight.</li>
<li><strong>Global</strong> - global settings set on <code class="language-plaintext highlighter-rouge">/sitecore/system/Settings/Foundation/Experience Accelerator/Theming/Optimiser/Styles</code> or <code class="language-plaintext highlighter-rouge">/sitecore/system/Settings/Foundation/Experience Accelerator/Theming/Optimiser/Scripts</code>
<ul>
<li>available options: <code class="language-plaintext highlighter-rouge">Concatenate</code>, <code class="language-plaintext highlighter-rouge">Concatenate And Minify</code>, <code class="language-plaintext highlighter-rouge">Disabled</code></li>
</ul>
</li>
<li><strong>Site</strong> - site specific settings set on <strong>Page Designs</strong> item, field <strong>Styles/Scripts optimizing enabled</strong> (section: <strong>Assets Optimization</strong>)
<ul>
<li>available options: <code class="language-plaintext highlighter-rouge">Default</code>, <code class="language-plaintext highlighter-rouge">No</code>, <code class="language-plaintext highlighter-rouge">Yes</code></li>
</ul>
</li>
<li><strong>Theme</strong> - theme specific settings set on a theme item, field <strong>Mode</strong> (section: <strong>Theme</strong>)
<ul>
<li>available options: <code class="language-plaintext highlighter-rouge">On</code>, <code class="language-plaintext highlighter-rouge">Off</code>, <code class="language-plaintext highlighter-rouge">Inherit from System</code>, <code class="language-plaintext highlighter-rouge">Inherit from Site</code></li>
</ul>
</li>
<li><strong>Result</strong> - outcome of configuration set. <strong>YES</strong> indicates assets will be processed.</li>
</ul>
<table class="table">
<thead>
<tr>
<th style="text-align: left">Asset</th>
<th style="text-align: left">Global</th>
<th style="text-align: left">Site</th>
<th style="text-align: left">Theme</th>
<th style="text-align: right">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left"><strong>Site - explicitly disabled</strong></td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: right"> </td>
</tr>
<tr>
<td style="text-align: left"><em>script/style</em></td>
<td style="text-align: left"><code class="language-plaintext highlighter-rouge">[ANY]</code></td>
<td style="text-align: left">No</td>
<td style="text-align: left">Inherit from site</td>
<td style="text-align: right"><strong>NO</strong></td>
</tr>
<tr>
<td style="text-align: left"><strong>Site - explicitly enabled</strong></td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: right"> </td>
</tr>
<tr>
<td style="text-align: left"><em>script/style</em></td>
<td style="text-align: left"><code class="language-plaintext highlighter-rouge">[ANY]</code></td>
<td style="text-align: left">Yes</td>
<td style="text-align: left">Inherit from site</td>
<td style="text-align: right"><strong>YES</strong></td>
</tr>
<tr>
<td style="text-align: left"><strong>Site - use default settings (global)</strong></td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: right"> </td>
</tr>
<tr>
<td style="text-align: left"><em>script/style</em></td>
<td style="text-align: left">Concatenate And Minify</td>
<td style="text-align: left">Default</td>
<td style="text-align: left">Inherit from site</td>
<td style="text-align: right"><strong>YES</strong></td>
</tr>
<tr>
<td style="text-align: left"><em>script/style</em></td>
<td style="text-align: left">Disabled</td>
<td style="text-align: left">Default</td>
<td style="text-align: left">Inherit from site</td>
<td style="text-align: right"><strong>NO</strong></td>
</tr>
<tr>
<td style="text-align: left"><strong>Theme - respects only global</strong></td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: right"> </td>
</tr>
<tr>
<td style="text-align: left"><em>script/style</em></td>
<td style="text-align: left">Disabled</td>
<td style="text-align: left">Default</td>
<td style="text-align: left">Inherit from system</td>
<td style="text-align: right"><strong>NO</strong></td>
</tr>
<tr>
<td style="text-align: left"><em>script/style</em></td>
<td style="text-align: left">Concatenate And Minify</td>
<td style="text-align: left">Default</td>
<td style="text-align: left">Inherit from system</td>
<td style="text-align: right"><strong>YES</strong></td>
</tr>
<tr>
<td style="text-align: left"><strong>Theme - explicitly disabled</strong></td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: right"> </td>
</tr>
<tr>
<td style="text-align: left"><em>script/style</em></td>
<td style="text-align: left"><code class="language-plaintext highlighter-rouge">[ANY]</code></td>
<td style="text-align: left">Default</td>
<td style="text-align: left">Off</td>
<td style="text-align: right"><strong>NO</strong></td>
</tr>
<tr>
<td style="text-align: left"><strong>Theme - explicitly enabled</strong></td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: left"> </td>
<td style="text-align: right"> </td>
</tr>
<tr>
<td style="text-align: left"><em>script/style</em></td>
<td style="text-align: left"><code class="language-plaintext highlighter-rouge">[ANY]</code></td>
<td style="text-align: left">Default</td>
<td style="text-align: left">On</td>
<td style="text-align: right"><strong>YES</strong></td>
</tr>
</tbody>
</table>
<h1 id="summary">Summary</h1>
<p>Hopefully this table made it easier to understand how to configure <strong>Asset Optimizer</strong>. If you have any questions, just ask.</p>
<p><a href="https://alan-null.github.io/2023/10/ao-optimized">Asset Optimizer configuration</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on October 04, 2023.</p>
https://alan-null.github.io/2021/11/items-as-resources-and-unicorn2021-11-21T00:00:00+01:002021-11-21T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>How to use Unicorn serialization data to generate items as resources (<code class="language-plaintext highlighter-rouge">*.dat</code>) <!--more--></p>
<h1 id="unicorn-to-items-as-resources">Unicorn to Items as Resources</h1>
<h3 id="prerequisites">Prerequisites</h3>
<p>Install or update your <a href="https://doc.sitecore.com/en/developers/101/developer-tools/install-sitecore-command-line-interface.html">Sitecore CLI to version 4</a> (<a href="https://doc.sitecore.com/en/developers/101/developer-tools/upgrade-the-sitecore-command-line-interface-to-version-4.html">upgrade guide</a>) then install plugins.</p>
<p><strong>List of required plugins:</strong></p>
<ul>
<li><a href="https://doc.sitecore.com/en/developers/101/developer-tools/items-as-resources-plugin.html">Sitecore.DevEx.Extensibility.ResourcePackage@4.0.0</a></li>
<li><a href="https://doc.sitecore.com/en/developers/101/developer-tools/serialization-plugin.html">Sitecore.DevEx.Extensibility.Serialization@4.0.0</a></li>
</ul>
<p><strong>Installation</strong></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>C:<span class="se">\></span> <span class="nb">mkdir </span>sitecore.cli
C:<span class="se">\></span> <span class="nb">cd</span> .<span class="se">\s</span>itecore.cli<span class="se">\</span>
C:<span class="se">\s</span>itecore.cli> dotnet new tool-manifest
C:<span class="se">\s</span>itecore.cli> dotnet nuget add <span class="nb">source</span> <span class="nt">-n</span> Sitecore https://sitecore.myget.org/F/sc-packages/api/v3/index.json
C:<span class="se">\s</span>itecore.cli> dotnet tool <span class="nb">install </span>Sitecore.CLI
C:<span class="se">\s</span>itecore.cli> dotnet sitecore init
C:<span class="se">\s</span>itecore.cli> dotnet sitecore plugin add <span class="nt">-n</span> Sitecore.DevEx.Extensibility.Serialization
Successfully installed version 4.0.0 of plugin Sitecore.DevEx.Extensibility.Serialization
C:<span class="se">\s</span>itecore.cli> dotnet sitecore plugin add <span class="nt">-n</span> Sitecore.DevEx.Extensibility.ResourcePackage
Successfully installed version 4.0.0 of plugin Sitecore.DevEx.Extensibility.ResourcePackage
</code></pre></div></div>
<h1 id="convert-unicorn-to-items-as-resources">Convert Unicorn to Items as Resources</h1>
<h2 id="overview">Overview</h2>
<p>Currently (<code class="language-plaintext highlighter-rouge">version 4.0.0</code>) there are two sub-commands available.</p>
<ul>
<li>
<p><strong><code class="language-plaintext highlighter-rouge">unicorn</code></strong> - creates a new resource package from unicorn serialization <strong>folder</strong>,</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dotnet sitecore itemres unicorn <span class="nt">-p</span> <span class="s2">"PowerShell"</span> <span class="nt">-o</span> <span class="s2">"PSPackage"</span> <span class="nt">--overwrite</span>
</code></pre></div> </div>
</li>
<li>
<p><strong><code class="language-plaintext highlighter-rouge">create</code></strong> - creates a new resource package from <strong>modules</strong></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dotnet sitecore itemres create <span class="nt">-o</span> ../_out/output.name <span class="nt">--overwrite</span> <span class="nt">-i</span> XA.Reference.<span class="k">*</span>
</code></pre></div> </div>
</li>
</ul>
<p>where <code class="language-plaintext highlighter-rouge">XA.Reference.*</code> is a wildcard for your module names.</p>
<p>Complete documentation for all the commands and their options can be found <a href="https://doc.sitecore.com/en/developers/101/developer-tools/the-cli-itemres-command.html#options">here</a></p>
<h2 id="generate-using-modules">Generate using modules</h2>
<p>Personally, I prefer to use <code class="language-plaintext highlighter-rouge">create</code> command. Here are some pros and cons:</p>
<p>✅ you’ve got complete control on what goes into the resource file when using <strong><code class="language-plaintext highlighter-rouge">unicorn</code></strong> you cannot control it (filter certain items, split them into smaller modules)</p>
<p>❌ you have to synchronize modules definition (convert unicorn serialization configurations into modules)</p>
<p>Follow the examples below to convert your serialization configuration files into modules:</p>
<ul>
<li>define the location of your module in <strong>sitecore.json</strong></li>
</ul>
<figure class="highlight"><pre><code class="language-json" data-lang="json"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
</pre></td><td class="code"><pre><span class="nl">"modules"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="s2">"modules/*/*.module.json"</span><span class="p">,</span><span class="w">
</span><span class="s2">"modules/*.module.json"</span><span class="p">,</span><span class="w">
</span><span class="s2">"modules/*/*/*.module.json"</span><span class="w">
</span><span class="p">]</span>
</pre></td></tr></tbody></table></code></pre></figure>
<ul>
<li>
<p>convert Unicorn serialization configuration to CLI modules</p>
<p><strong>Unicorn serialization file</strong></p>
</li>
</ul>
<figure class="highlight"><pre><code class="language-xml" data-lang="xml"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre><span class="nt"><configuration</span> <span class="na">xmlns:patch=</span><span class="s">"http://www.sitecore.net/xmlconfig/"</span><span class="nt">></span>
<span class="nt"><sitecore></span>
<span class="nt"><unicorn></span>
<span class="nt"><configurations></span>
<span class="nt"><configuration</span> <span class="na">name=</span><span class="s">"XA.Reference.Project.Blog"</span> <span class="na">description=</span><span class="s">""</span> <span class="na">dependencies=</span><span class="s">"XA.Reference.Project.Common"</span> <span class="na">patch:after=</span><span class="s">"configuration[@name='Foundation.Serialization']"</span><span class="nt">></span>
<span class="nt"><targetDataStore</span> <span class="na">physicalRootPath=</span><span class="s">"$(sourceFolder)\Project\Blog\serialization"</span> <span class="na">type=</span><span class="s">"Rainbow.Storage.SerializationFileSystemDataStore, Rainbow"</span> <span class="na">useDataCache=</span><span class="s">"false"</span> <span class="na">singleInstance=</span><span class="s">"true"</span> <span class="nt">/></span>
<span class="nt"><predicate</span> <span class="na">type=</span><span class="s">"Unicorn.Predicates.SerializationPresetPredicate, Unicorn"</span> <span class="na">singleInstance=</span><span class="s">"true"</span><span class="nt">></span>
<span class="nt"><include</span> <span class="na">name=</span><span class="s">"Content"</span> <span class="na">database=</span><span class="s">"master"</span> <span class="na">path=</span><span class="s">"/sitecore/content/SXA Reference/Blog"</span><span class="nt">/></span>
<span class="nt"><include</span> <span class="na">name=</span><span class="s">"Media Library"</span> <span class="na">database=</span><span class="s">"master"</span> <span class="na">path=</span><span class="s">"/sitecore/media library/Project/SXA Reference/Blog"</span><span class="nt">/></span>
<span class="nt"><include</span> <span class="na">name=</span><span class="s">"Themes"</span> <span class="na">database=</span><span class="s">"master"</span> <span class="na">path=</span><span class="s">"/sitecore/media library/Themes/SXA Reference/Blog"</span><span class="nt">/></span>
<span class="nt"><include</span> <span class="na">name=</span><span class="s">"Templates"</span> <span class="na">database=</span><span class="s">"master"</span> <span class="na">path=</span><span class="s">"/sitecore/templates/Project/SXA Reference/Blog"</span><span class="nt">/></span>
<span class="nt"></predicate></span>
<span class="nt"></configuration></span>
<span class="nt"></configurations></span>
<span class="nt"></unicorn></span>
<span class="nt"></sitecore></span>
<span class="nt"></configuration></span>
</pre></td></tr></tbody></table></code></pre></figure>
<p><strong>CLI Module</strong></p>
<figure class="highlight"><pre><code class="language-json" data-lang="json"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre><span class="p">{</span><span class="w">
</span><span class="nl">"namespace"</span><span class="p">:</span><span class="w"> </span><span class="s2">"XA.Reference.Project.Blog"</span><span class="p">,</span><span class="w">
</span><span class="nl">"items"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"~/../src/Project/Blog/serialization"</span><span class="p">,</span><span class="w">
</span><span class="nl">"includes"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Content"</span><span class="p">,</span><span class="w">
</span><span class="nl">"database"</span><span class="p">:</span><span class="w"> </span><span class="s2">"master"</span><span class="p">,</span><span class="w">
</span><span class="nl">"path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/sitecore/content/SXA Reference/Blog"</span><span class="p">,</span><span class="w">
</span><span class="nl">"scope"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ItemAndDescendants"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Media Library"</span><span class="p">,</span><span class="w">
</span><span class="nl">"database"</span><span class="p">:</span><span class="w"> </span><span class="s2">"master"</span><span class="p">,</span><span class="w">
</span><span class="nl">"path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/sitecore/media library/Project/SXA Reference/Blog"</span><span class="p">,</span><span class="w">
</span><span class="nl">"scope"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ItemAndDescendants"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Themes"</span><span class="p">,</span><span class="w">
</span><span class="nl">"database"</span><span class="p">:</span><span class="w"> </span><span class="s2">"master"</span><span class="p">,</span><span class="w">
</span><span class="nl">"path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/sitecore/media library/Themes/SXA Reference/Blog"</span><span class="p">,</span><span class="w">
</span><span class="nl">"scope"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ItemAndDescendants"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Templates"</span><span class="p">,</span><span class="w">
</span><span class="nl">"database"</span><span class="p">:</span><span class="w"> </span><span class="s2">"master"</span><span class="p">,</span><span class="w">
</span><span class="nl">"path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/sitecore/templates/Project/SXA Reference/Blog"</span><span class="p">,</span><span class="w">
</span><span class="nl">"scope"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ItemAndDescendants"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<p><strong>Automatic module generator</strong></p>
<p>It’s not production-ready (not all the cases are handled) but it makes conversion a lot easier.</p>
<p>It takes as an input serialization file and creates a module for it.</p>
<p>You can find it <a href="https://github.com/alan-null/XA.Reference/blob/master/cli/ps/cmdlets/Generate-Modules.ps1">here</a></p>
<p>Usage:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Get-ChildItem</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="s1">'..\..\src\Foundation'</span><span class="w"> </span><span class="nt">-Recurse</span><span class="w"> </span><span class="nt">-Filter</span><span class="w"> </span><span class="s2">"*.Serialization.config"</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="o">.</span><span class="n">\Generate-Modules.ps1</span><span class="w"> </span><span class="nt">-filePath</span><span class="w"> </span><span class="bp">$_</span><span class="o">.</span><span class="nf">FullName</span><span class="w"> </span><span class="nt">-outputFolder</span><span class="w"> </span><span class="s2">"..\modules\Foundation"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<h1 id="summary">Summary</h1>
<p>If you are using Unicorn for serialization and want to deliver items as resource packages you can make it happen with minimal effort.</p>
<p><a href="https://alan-null.github.io/2021/11/items-as-resources-and-unicorn">Items as resources and Unicorn</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on November 21, 2021.</p>
https://alan-null.github.io/2020/11/sitecore-extensions_v3_4_02020-11-07T00:00:00+01:002020-11-07T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>This release brings three new features, few improvements and bug fixes. <!--more--></p>
<h1 id="new-features">New features</h1>
<h3 id="add-here---placeholder-name">Add here - placeholder name</h3>
<p>While working with many placeholders located next to each other it might be difficult to know to which placeholder new rendering will be added.</p>
<p>In SXA you can see the location (placeholder path) while using drag & drop but the default Sitecore method doesn’t highlight any placeholder information.</p>
<p>This is my proposition to make it just a little bit better.</p>
<p><a href="/images/posts/sc-ext-3.4.0/add-here-ph-name.gif" class="img-container">
<img src="/images/posts/sc-ext-3.4.0/poster/add-here-ph-name.png" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="remove-all-components-inside-a-placeholder">Remove all components inside a placeholder</h3>
<p>Imagine a situation when you’ve added many renderings to a placeholder and you changed your mind about design.</p>
<p>Instead of removing all renderings one by one just find the containing placeholder and click on the new icon to delete all renderings inside it.</p>
<p><a href="/images/posts/sc-ext-3.4.0/remove-all-from-ph.gif" class="img-container">
<img src="/images/posts/sc-ext-3.4.0/poster/remove-all-from-ph.png" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="extension-notifications-">Extension notifications 🔔</h3>
<p>Not necessary something that you will use but I can use it to communicate with you instead 😎</p>
<p>Don’t worry I am not going to spam you with unnecessary notifications. I added it to display only the information that is required.</p>
<p>If needed I will add an ability to disable this communication channel completely.</p>
<p><a href="/images/posts/sc-ext-3.4.0/notifications.png">
<img src="/images/posts/sc-ext-3.4.0/notifications.png" />
</a></p>
<h3 id="new-admin-shortcuts">New admin shortcuts</h3>
<p>Missing shortcuts exposed in the Administration panel were added to <a href="https://github.com/alan-null/sc_ext/wiki/Launcher">Launcher module</a>.</p>
<h1 id="updated-features">Updated features</h1>
<h3 id="deep-link-to-an-item-in-content-editor">Deep-link to an item in Content Editor</h3>
<p>This is an improvement to the command introduced in the <a href="/2020/04/sitecore-extensions_v3_3_0">previous release</a></p>
<p>I improved it a little bit so link will contain a <strong>database</strong> and <strong>language</strong> in a query string.</p>
<h3 id="field-inspector---loading">Field inspector - loading</h3>
<p>When an app is not warmed up yet you might encounter longer response time to some of the requests made by an extension. To let know users that everything is fine and we need to wait for the result a little bit longer extension will display <code class="language-plaintext highlighter-rouge">Loading...</code> text.</p>
<p>Additionally, notification pop-up will be displayed for those who are really nervous.</p>
<h3 id="open-item-in-new-tab-on-ctrl--enter">Open item in new tab on Ctrl + Enter</h3>
<p>Launcher provides a new command (<code class="language-plaintext highlighter-rouge">Open item in new tab</code>)</p>
<p>You use it to open a currently selected item in a new tab (Content Editor).</p>
<h2 id="bug-fixes">Bug fixes</h2>
<p>If you are interested what bugs were fixed in this release, you will find them <a href="https://github.com/alan-null/sc_ext/issues?q=is%3Aissue+milestone%3A3.4.0+is%3Aclosed+label%3Abug">here</a></p>
<h1 id="summary">Summary</h1>
<p>Special thanks to gentlemen who reported issues and suggestions on <a href="https://github.com/alan-null/sc_ext/issues">Github</a>:</p>
<ul>
<li><a href="https://github.com/aburok"><strong>aburok</strong></a></li>
<li><a href="https://github.com/jflheureux"><strong>jflheureux</strong></a></li>
<li><a href="https://github.com/MidasVE"><strong>MidasVE</strong></a></li>
</ul>
<p>Thank you. It kept me motivated to deliver this update.</p>
<p>Got a nice idea for module/command?</p>
<p>Please create <a href="//github.com/alan-null/sc_ext/issues/new">new ticket</a> on GitHub or let me know on twitter <a href="//twitter.com/alanploc">@AlanPloc</a>.</p>
<p><strong>Useful links:</strong></p>
<ul>
<li><a href="https://chrome.google.com/webstore/detail/sitecore-extensions/aoclhcccfdkjddgpaaajldgljhllhgmd">Google Chrome Store: Sitecore Extensions</a></li>
<li><a href="https://github.com/alan-null/sc_ext.firefox">Mozilla Addons: Sitecore Extensions</a></li>
<li><a href="https://github.com/alan-null/sc_ext/issues">Github Issues</a></li>
<li><a href="https://github.com/alan-null/sc_ext/milestone/7?closed=1">Version 3.4.0 changelog</a></li>
<li><a href="https://github.com/alan-null/sc_ext/releases/tag/v3.4.0">Release notes</a></li>
</ul>
<p><a href="https://alan-null.github.io/2020/11/sitecore-extensions_v3_4_0">Sitecore Extensions version 3.4 released</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on November 07, 2020.</p>
https://alan-null.github.io/2020/04/sitecore-extensions_v3_3_02020-04-16T00:00:00+02:002020-04-16T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>It’s been a long time ago when I released the last version of my extension 🙄</p>
<p>This minor release brings two features and few improvements, bug fixes. <!--more--></p>
<h1 id="new-features">New features</h1>
<h3 id="deep-link-to-an-item-in-content-editor">Deep-link to an item in Content Editor</h3>
<p>There is a new command in the <strong>Launcher</strong> module.</p>
<p>When invoked it will copy “deep-link” to the context item.</p>
<p>Link will look similar to this one:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>https://sc/sitecore/shell/Applications/Content%20Editor.aspx?sc_bw<span class="o">=</span>1&fo<span class="o">={</span>110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9<span class="o">}</span>
</code></pre></div></div>
<p><a href="/images/posts/sc-ext-3.3.0/new-deep-link.gif" class="img-container">
<img src="/images/posts/sc-ext-3.3.0/new-deep-link.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<p>Right now this feature is exposed only via Launcher command.</p>
<h3 id="open-the-current-item-in-dbbrowser">Open the current item in dbbrowser</h3>
<p>Quick teleport from Content Editor to <strong>dbbrowser.aspx</strong> with context item.</p>
<p><a href="/images/posts/sc-ext-3.3.0/new-open-in-dbbrowser.gif" class="img-container">
<img src="/images/posts/sc-ext-3.3.0/new-open-in-dbbrowser.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="extension-icon">Extension icon</h3>
<p>Minor update to internal functionality. Now you will never miss a new release</p>
<p>(taking into account current release cadence it is needed 😂)</p>
<p>When you click on it you will be redirected to a page with release notes.</p>
<table>
<thead>
<tr>
<th>Regular icon</th>
<th style="text-align: center">Icon after each update</th>
</tr>
</thead>
<tbody>
<tr>
<td><img src="/images/posts/sc-ext-3.3.0/new-badge-icon-old.png" /></td>
<td style="text-align: center"><img src="/images/posts/sc-ext-3.3.0/new-badge-icon-new.png" /></td>
</tr>
</tbody>
</table>
<h1 id="updated-features">Updated features</h1>
<h3 id="field-inspector---loading">Field inspector - loading</h3>
<p>When an app is not warmed up yet you might encounter longer response time to some of the requests made by an extension. To let know users that everything is fine and we need to wait for the result a little bit longer extension will display <code class="language-plaintext highlighter-rouge">Loading...</code> text.</p>
<p><a href="/images/posts/sc-ext-3.3.0/modified-loading.gif" class="img-container">
<img src="/images/posts/sc-ext-3.3.0/modified-loading.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="field-name---auto-select">Field name - auto-select</h3>
<p>It was really hard to select field name without flipping it back and forth to field description. Right now field inspector will select field names automatically.</p>
<p><a href="/images/posts/sc-ext-3.3.0/modified-highlight.gif" class="img-container">
<img src="/images/posts/sc-ext-3.3.0/modified-highlight.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h1 id="summary">Summary</h1>
<p>Got a nice idea for module/command?</p>
<p>Please create <a href="//github.com/alan-null/sc_ext/issues/new">new ticket</a> on GitHub or let me know on twitter <a href="//twitter.com/alanploc">@AlanPloc</a>.</p>
<p><strong>Useful links:</strong></p>
<ul>
<li><a href="https://chrome.google.com/webstore/detail/sitecore-extensions/aoclhcccfdkjddgpaaajldgljhllhgmd">Google Chrome Store: Sitecore Extensions</a></li>
<li><a href="https://github.com/alan-null/sc_ext.firefox">Mozilla Addons: Sitecore Extensions</a></li>
<li><a href="https://github.com/alan-null/sc_ext/issues">Github Issues</a></li>
<li><a href="https://github.com/alan-null/sc_ext/issues?utf8=%E2%9C%93&q=milestone:3.3%20">Version 3.3 changelog</a></li>
<li><a href="https://github.com/alan-null/sc_ext/releases/tag/v3.3.0">Release notes</a></li>
</ul>
<p><a href="https://alan-null.github.io/2020/04/sitecore-extensions_v3_3_0">Sitecore Extensions version 3.3 released</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on April 16, 2020.</p>
https://alan-null.github.io/2019/12/sxa-scaffolding-debugging2019-12-03T00:00:00+01:002019-12-03T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>This article describes how to debug SXA Scaffolding. <!--more--></p>
<h1 id="introduction">Introduction</h1>
<p>Have you ever encountered problems with SXA scaffolding?</p>
<p>Probably no because it works flawlessly 😎</p>
<p>You might still see it crashing when you try to write your modules and extend scaffolding.</p>
<p><a href="/images/posts/scaffolding-debugging/scaffolding-error.png">
<img src="/images/posts/scaffolding-debugging/scaffolding-error.png" alt="" />
</a></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>20:51:37 INFO The script execution in ScriptSession '$scriptSession$|i1wx3djw0xyhw0gtyhbutqyr|38b9487a-d259-400e-a503-7f25c853bc50' completed in 7 ms.
20:51:58 ERROR Cannot bind argument to parameter 'Item' because it is null.
20:51:58 INFO The script execution in ScriptSession '$scriptSession$|i1wx3djw0xyhw0gtyhbutqyr|3efa12c1-8489-41d1-a1d8-3f2b0f43d4d0' completed in 29170 ms.
</code></pre></div></div>
<p>As logs are not always a good source of information we have to find the other way.</p>
<p>Based on my experience with <a href="https://github.com/SitecorePowerShell/Console/releases"><strong>Sitecore Powershell Extensions</strong></a> and <a href="https://doc.sitecore.com/developers/sxa/19/sitecore-experience-accelerator/en/add-modules-to-site-and-tenant-scaffolding.html"><strong>SXA scaffolding</strong></a> I will share with you how to deal with that.</p>
<h1 id="debugging">Debugging</h1>
<p>Almost every cmdlet in SXA is a separate item. It makes things hard to debug if code is not in a single place/file (<a href="https://www.youtube.com/watch?v=6rhPWVKcreI">see how to debug in SPE</a>)</p>
<p>Thanks to the fact that all cmdlets written in SXA follow a common scheme we can find out where exactly our logic has failed.</p>
<p>Notice <code class="language-plaintext highlighter-rouge">Write-Verbose</code> calls in this example</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kr">function</span><span class="w"> </span><span class="nf">Do-AwesomeThing</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="p">[</span><span class="n">CmdletBinding</span><span class="p">()]</span><span class="w">
</span><span class="kr">param</span><span class="p">(</span><span class="o">..</span><span class="p">)</span><span class="w">
</span><span class="kr">begin</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="n">Write-Verbose</span><span class="w"> </span><span class="s2">"Cmdlet Do-AwesomeThing - Begin"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="kr">process</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="n">Write-Verbose</span><span class="w"> </span><span class="s2">"Cmdlet Do-AwesomeThing - Process"</span><span class="w">
</span><span class="c"># Awesome logic</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="kr">end</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="n">Write-Verbose</span><span class="w"> </span><span class="s2">"Cmdlet Do-AwesomeThing - End"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>Thanks to <code class="language-plaintext highlighter-rouge">Write-Verbose</code> we can track how scripts were executed - both the order and nesting.</p>
<h2 id="debug-with-verbose-switch">Debug with Verbose switch</h2>
<p>I already recommended this way to many people on the community slack with pretty good results.</p>
<p>All you have to do is to add <code class="language-plaintext highlighter-rouge">-Verbose</code> switch to the script that you want to debug.</p>
<p>Let’s assume that you see an error while creating a tenant.</p>
<p>Follow the steps below</p>
<ul>
<li>Open <strong>ISE</strong> <code class="language-plaintext highlighter-rouge">https://sc/sitecore/shell/Applications/PowerShell/PowerShellIse?sc_bw=1</code></li>
<li>Find and open a script that you want to debug</li>
</ul>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/sitecore/system/Modules/PowerShell/Script Library/SXA/SXA - Scaffolding/Content Editor/Insert Item/Tenant
</code></pre></div></div>
<ul>
<li>Remove <code class="language-plaintext highlighter-rouge">try</code>/<code class="language-plaintext highlighter-rouge">catch</code> wrappers to let output appear on a console</li>
<li>Add <code class="language-plaintext highlighter-rouge">-Verbose</code> switch to the cmdlet that fails</li>
</ul>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ctx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">gi</span><span class="w"> </span><span class="o">.</span><span class="w">
</span><span class="n">Import-Function</span><span class="w"> </span><span class="nx">New-Tenant</span><span class="w">
</span><span class="nv">$model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Show-NewTenantDialog</span><span class="w"> </span><span class="nv">$ctx</span><span class="w">
</span><span class="n">New-Tenant</span><span class="w"> </span><span class="nv">$model</span><span class="w"> </span><span class="nt">-Verbose</span><span class="w">
</span></code></pre></div></div>
<p>Once you run the script you will see an error (if something is broken of course)</p>
<p><a href="/images/posts/scaffolding-debugging/verbose-output.png">
<img src="/images/posts/scaffolding-debugging/verbose-output.png" alt="" />
</a></p>
<p>As you can see it failed while trying to execute the following action:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/sitecore/system/Settings/Foundation/Experience Accelerator/Multisite/Multisite Tenant Setup/Break
</code></pre></div></div>
<p>There might be different problems with this script. You probably know better 😄</p>
<p>The thing is that you know where to look to solve the problem.</p>
<h2 id="debug-with-call-stack-visualizer">Debug with call-stack visualizer</h2>
<p>This approach is very similar to the previous method but it adds additional PowerShell magic to make things much nicer</p>
<p>The idea here is to wrap code with something like this</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$outStream</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="err">$</span><span class="p">(</span><span class="w"> </span><span class="o">.</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="c"># CODE TO DEBUG GOES HERE</span><span class="w">
</span><span class="p">}</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Out-Null</span><span class="p">)</span><span class="w"> </span><span class="mi">2</span><span class="err">></span><span class="o">&</span><span class="mi">1</span><span class="w"> </span><span class="mi">4</span><span class="err">></span><span class="o">&</span><span class="mi">1</span><span class="w">
</span><span class="nv">$lines</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Convert-FromOutStreamToXML</span><span class="w"> </span><span class="nv">$outStream</span><span class="w">
</span><span class="n">Out-Download</span><span class="w"> </span><span class="nt">-Name</span><span class="w"> </span><span class="s2">"log.xml"</span><span class="w"> </span><span class="nt">-InputObject</span><span class="w"> </span><span class="p">([</span><span class="n">string</span><span class="p">[]]</span><span class="nv">$lines</span><span class="p">)</span><span class="w">
</span></code></pre></div></div>
<p>Grab the latest version of a script from GitHub: <a href="https://github.com/PowerShellLibrary/Sitecore/blob/master/SXA/Scaffolding/Debug-SxaScaffolding.ps1"><strong>Debug-SxaScaffolding.ps1</strong></a></p>
<p>As a result, you will get call stack of all scaffolding actions represented as <strong>XML</strong></p>
<p>To use this method follow the steps below:</p>
<ul>
<li>Open <strong>ISE</strong> <code class="language-plaintext highlighter-rouge">https://sc/sitecore/shell/Applications/PowerShell/PowerShellIse?sc_bw=1</code></li>
</ul>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">/sitecore/system/Modules/PowerShell/Script</span><span class="w"> </span><span class="nx">Library/SXA/SXA</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="nx">Scaffolding/Content</span><span class="w"> </span><span class="nx">Editor/Insert</span><span class="w"> </span><span class="nx">Item/Tenant</span><span class="w">
</span></code></pre></div></div>
<ul>
<li>Find and open a script that you want to debug</li>
<li>Remove <code class="language-plaintext highlighter-rouge">try</code>/<code class="language-plaintext highlighter-rouge">catch</code> wrappers to let output appear on a console</li>
<li>Wrap code that you want to debug</li>
</ul>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$outStream</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="err">$</span><span class="p">(</span><span class="w"> </span><span class="o">.</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nv">$ctx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Item</span><span class="w"> </span><span class="o">.</span><span class="w">
</span><span class="n">Import-Function</span><span class="w"> </span><span class="nx">New-Tenant</span><span class="w">
</span><span class="nv">$model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Show-NewTenantDialog</span><span class="w"> </span><span class="nv">$ctx</span><span class="w">
</span><span class="n">New-Tenant</span><span class="w"> </span><span class="nv">$model</span><span class="w"> </span><span class="nt">-ver</span><span class="w">
</span><span class="p">}</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Out-Null</span><span class="p">)</span><span class="w"> </span><span class="mi">2</span><span class="err">></span><span class="o">&</span><span class="mi">1</span><span class="w"> </span><span class="mi">4</span><span class="err">></span><span class="o">&</span><span class="mi">1</span><span class="w">
</span><span class="nv">$lines</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Convert-FromOutStreamToXML</span><span class="w"> </span><span class="nv">$outStream</span><span class="w">
</span><span class="n">Out-Download</span><span class="w"> </span><span class="nt">-Name</span><span class="w"> </span><span class="s2">"log.xml"</span><span class="w"> </span><span class="nt">-InputObject</span><span class="w"> </span><span class="p">([</span><span class="n">string</span><span class="p">[]]</span><span class="nv">$lines</span><span class="p">)</span><span class="w">
</span></code></pre></div></div>
<p><strong>Example output</strong></p>
<p>Error details will be stored in <error> tags.</error></p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><cmdlet</span> <span class="na">name=</span><span class="s">"Invoke_TenantAction"</span><span class="nt">></span>
<span class="nt"><process_Invoke_TenantAction</span> <span class="nt">/></span>
<span class="nt"><cmdlet</span> <span class="na">name=</span><span class="s">"Get_TenantTemplate"</span><span class="nt">></span>
<span class="nt"><process_Get_TenantTemplate</span> <span class="nt">/></span>
<span class="nt"></cmdlet></span>
<span class="nt"><message</span> <span class="na">value=</span><span class="s">"Invoking Tenant Action: /sitecore/system/Settings/Foundation/Experience Accelerator/Multisite/Multisite Tenant Setup/Break"</span> <span class="nt">/></span>
<span class="nt"><cmdlet</span> <span class="na">name=</span><span class="s">"Invoke_ExecuteScript"</span><span class="nt">></span>
<span class="nt"><process_Invoke_ExecuteScript</span> <span class="nt">/></span>
<span class="nt"><message</span> <span class="na">value=</span><span class="s">"Executing script: "</span> <span class="nt">/></span>
<span class="nt"><message</span> <span class="na">value=</span><span class="s">"Current tenant: /sitecore/content/D/t22"</span> <span class="nt">/></span>
<span class="nt"><message</span> <span class="na">value=</span><span class="s">"Tenant templates: {93D18F94-3680-4596-B70B-8AFBFF3CFCE0} {2CE747C9-6961-4560-A96A-4AC008D3DC68} {776A5655-19B7-4C1D-9838-E19621FB2FEB} {EC6F5B8B-A556-4364-8441-61BC1F54CAF0} {5FFB8B43-40F1-46F2-B49E-727FB74CB732} {F543A2D2-5C28-44E3-8C52-3491AAC234F4} {BF5608F4-E886-43FA-865C-FBBEE3543CED} {4BA0DFA4-B03C-418D-98BC-378E9D6B915F} {A80EE8A0-C2BF-4A0C-BE71-232A54368EA1} {6F12ECCB-F3C4-43D9-A415-B6BF29015D60}"</span> <span class="nt">/></span>
<span class="nt"><error</span> <span class="na">script=</span><span class="s">"Invoke-ExecuteScript"</span> <span class="na">line=</span><span class="s">"51"</span> <span class="na">char=</span><span class="s">"17"</span><span class="nt">></span>
<span class="nt"><message</span> <span class="na">value=</span><span class="s">"Cannot bind argument to parameter 'Item' because it is null."</span> <span class="nt">/></span>
<span class="nt"><line</span> <span class="na">value=</span><span class="s">"Invoke-ExecuteScript $ActionItem $tenant $tenantTemplates, ,"</span> <span class="nt">/></span>
<span class="nt"></error></span>
<span class="nt"></cmdlet></span>
<span class="nt"></cmdlet></span>
</code></pre></div></div>
<p>This is only a part of the output. You can see the whole file <a href="https://gist.github.com/alan-null/9adbc5f7ea0ecc98c3c5a2b72421c369">here</a></p>
<p>If you will open this file in any text editor you can easily fold unwanted parts and see only what matters to you.</p>
<h1 id="summary">Summary</h1>
<p>I hope that no one will ever need it for debugging errors. I wish you all bugless development.</p>
<p>The thing about the script for visualizing call stack is that you can see how every script work, especially complicated ones, with a lot of different cmdlets used inside and multiple levels of nesting.</p>
<p><a href="https://alan-null.github.io/2019/12/sxa-scaffolding-debugging">SXA - Scaffolding debugging</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on December 03, 2019.</p>
https://alan-null.github.io/2019/02/cache-viewer2019-02-10T00:00:00+01:002019-02-10T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Another Sitecore Utility! This one lets you view what is currently inside Sitecore caches. You can also remove selected entries or clean whole content.<!--more--></p>
<h1 id="tldr">TL;DR</h1>
<p><a href="https://github.com/alan-null/Sitecore.Utilities/releases/download/2019-01-10/Sitecore.Utilities.Feature.CacheViewer-1.0.zip">
<strong>Package:</strong> Sitecore Utilities: Cache Viewer.zip
</a></p>
<p><a href="/images/posts/cache-viewer/demo.gif">
<strong>Demo:</strong> See quick presentation of all features.
</a></p>
<h1 id="prerequisites">Prerequisites</h1>
<p>To run this utility you will need:</p>
<ul>
<li><a href="https://marketplace.sitecore.net/en/Modules/Sitecore_PowerShell_console.aspx"><strong>Sitecore Powershell Extensions</strong></a></li>
</ul>
<h1 id="features">Features</h1>
<h3 id="run-cache-viewer">Run Cache Viewer</h3>
<p>You can run <strong>CacheViewer</strong> in two ways:</p>
<ul>
<li>Powershell Extensions Toolbox</li>
</ul>
<p><a href="/images/posts/cache-viewer/toolbox.gif" class="img-container">
<img src="/images/posts/cache-viewer/toolbox.jpg" alt="" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<ul>
<li>code</li>
</ul>
<figure class="highlight"><pre><code class="language-powershell" data-lang="powershell"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
</pre></td><td class="code"><pre><span class="n">Import-Function</span><span class="w"> </span><span class="nx">Show-CacheViewer</span><span class="w">
</span><span class="n">Show-CacheViewer</span>
</pre></td></tr></tbody></table></code></pre></figure>
<h3 id="refresh-all-caches">Refresh all caches</h3>
<p>Once you open <strong>CacheViewer</strong> you don’t have to reopen it to see changes.</p>
<p>Just press <strong>Refresh</strong> button and view will update.
<a href="/images/posts/cache-viewer/cache-view-refresh.gif" class="img-container">
<img src="/images/posts/cache-viewer/cache-view-refresh.jpg" alt="" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="open-single-cache">Open single cache</h3>
<p>If you want to inspect a particular cache:</p>
<ul>
<li>find it on the list</li>
<li>select it by clicking on it</li>
<li>press <strong>Open Cache</strong> button.</li>
</ul>
<p><a href="/images/posts/cache-viewer/cache-view-open-cache.gif" class="img-container">
<img src="/images/posts/cache-viewer/cache-view-open-cache.jpg" alt="" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="refresh-cache-entries">Refresh cache entries</h3>
<p>Once you open entry view you don’t have to reopen it to see updates.</p>
<p>Just press <strong>Refresh</strong> button and view will update.
<a href="/images/posts/cache-viewer/cache-entry-refresh-entries.gif" class="img-container">
<img src="/images/posts/cache-viewer/cache-entry-refresh-entries.jpg" alt="" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="remove-cache-entries">Remove cache entries</h3>
<p>You can remove cache entries by selecting it and pressing <strong>Remove Entries</strong> button from the ribbon.</p>
<p>If none of the cache entries will be selected you will be asked if you want to remove all of them.</p>
<p><a href="/images/posts/cache-viewer/cache-entry-remove-entries.gif" class="img-container">
<img src="/images/posts/cache-viewer/cache-entry-remove-entries.jpg" alt="" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="open-cache-entry">Open cache entry</h3>
<p>There is an ability to inspect particular cache entry.</p>
<p>You can see it in two modes:</p>
<ul>
<li>formatted (useful while inspecting HTML caches)</li>
<li>raw</li>
</ul>
<p><a href="/images/posts/cache-viewer/cache-entry-open-entry.gif" class="img-container">
<img src="/images/posts/cache-viewer/cache-entry-open-entry.jpg" alt="" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<p>Bear in mind that if you open <code class="language-plaintext highlighter-rouge">HTML</code> cache in <strong>formatted</strong> mode it will not look 1:1 as it looks on a page (missing styles)</p>
<h3 id="installation">Installation</h3>
<p>Download package from here:
<a href="https://github.com/alan-null/Sitecore.Utilities/releases/download/2019-01-10/Sitecore.Utilities.Feature.CacheViewer-1.0.zip">
Sitecore.Utilities.Feature.CacheViewer-1.0.zip
</a></p>
<p>This is standard Sitecore package.</p>
<h1 id="summary">Summary</h1>
<p>This utility is a part of <a href="https://github.com/alan-null/Sitecore.Utilities">Sitecore.Utilities</a>.</p>
<p>If you need more stuff like this one go to <a href="https://github.com/alan-null/Sitecore.Utilities#modules">Sitecore.Utilities modules section</a> and see what’s there.</p>
<p><a href="https://alan-null.github.io/2019/02/cache-viewer">Sitecore Utilities: Cache Viewer</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on February 10, 2019.</p>
https://alan-null.github.io/2019/01/unicorn-packaging2019-01-29T00:00:00+01:002019-01-29T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>If you use <strong>Unicorn</strong> for serialization and create packages manually in old Sitecore way, I think it’s time for a change. <!--more--></p>
<h1 id="introduction">Introduction</h1>
<p>I came to the conclusion that I might be doing something wrong more than 2 years ago.
I didn’t want to create XML manually, again.</p>
<p>I realized that a huge part of the information about items that I want to package is already in my repository (unicorn configuration).</p>
<p>I decided to leverage that knowledge and create packages like a boss.</p>
<h1 id="sitecore-utilities-unicorn-packaging">Sitecore Utilities: Unicorn Packaging</h1>
<h2 id="tldr">TL;DR</h2>
<p><strong>Unicorn</strong> + <strong>SPE</strong> = <strong>Unicorn Packaging</strong></p>
<p><strong>Scripts</strong>: <a href="https://github.com/alan-null/Sitecore.Utilities/tree/master/src/Feature/UnicornPackaging/serialization/PowerShell/UnicornPackaging/Functions">UnicornPackaging/Functions</a></p>
<p><a href="/files/posts/unicorn-packaging/Sitecore.Utilities.Feature.UnicornPackaging.zip">
<strong>Package:</strong> Sitecore.Utilities.Feature.UnicornPackaging.zip
</a></p>
<h2 id="about">About</h2>
<h3 id="sitecore-utilities">Sitecore Utilities</h3>
<p>First I need to clarify one thing:</p>
<p><strong>Sitecore Utilities</strong> is set of small utilities for Sitecore created by me that I use every day. Each one will be distributed as a separate package. They are to small to create separate repositories but I still want to have them versioned somewhere.</p>
<p><strong>Unicorn Packaging</strong> is a utility that I publish today as a part of <strong>Sitecore Utilities</strong></p>
<h3 id="prerequisites">Prerequisites</h3>
<p>Important thing. The whole thing was written in <strong>PowerShell</strong> so it should be obvious that this utility has a dependency on <strong>SPE</strong>.</p>
<p>Regarding <strong>Unicorn</strong>, later you will see that some things can be made easier in a newer version of Unicorn but the code was created in the middle of 2016 thus it can work on really old versions too.</p>
<h2 id="hot-to-use">Hot to use</h2>
<p>I assume that you already know <strong>Unicorn</strong> if you survived that far.</p>
<p>Let’s see some examples.</p>
<h3 id="example-unicorn-configuration">Example Unicorn configuration</h3>
<p>Before we start let’s create an example configuration for Unicorn with default items.</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><configuration</span> <span class="na">xmlns:patch=</span><span class="s">"http://www.sitecore.net/xmlconfig/"</span><span class="nt">></span>
<span class="nt"><sitecore></span>
<span class="nt"><unicorn></span>
<span class="nt"><configurations></span>
<span class="nt"><configuration</span> <span class="na">name=</span><span class="s">"Sitecore.Utilities.Feature.UnicornPackaging.Example"</span> <span class="na">description=</span><span class="s">""</span> <span class="na">dependencies=</span><span class="s">"Sitecore.Utilities.Foundation.Serialization"</span><span class="nt">></span>
<span class="nt"><targetDataStore</span> <span class="na">physicalRootPath=</span><span class="s">"$(sourceFolder)\Feature\UnicornPackaging\serialization-example"</span> <span class="na">type=</span><span class="s">"Rainbow.Storage.SerializationFileSystemDataStore, Rainbow"</span> <span class="na">useDataCache=</span><span class="s">"false"</span> <span class="na">singleInstance=</span><span class="s">"true"</span> <span class="nt">/></span>
<span class="nt"><predicate</span> <span class="na">type=</span><span class="s">"Unicorn.Predicates.SerializationPresetPredicate, Unicorn"</span> <span class="na">singleInstance=</span><span class="s">"true"</span><span class="nt">></span>
<span class="nt"><include</span> <span class="na">name=</span><span class="s">"Content"</span> <span class="na">database=</span><span class="s">"master"</span> <span class="na">path=</span><span class="s">"/sitecore/content/Home"</span><span class="nt">/></span>
<span class="nt"><include</span> <span class="na">name=</span><span class="s">"Template"</span> <span class="na">database=</span><span class="s">"master"</span> <span class="na">path=</span><span class="s">"/sitecore/templates/Sample/Sample Item"</span><span class="nt">/></span>
<span class="nt"></predicate></span>
<span class="nt"></configuration></span>
<span class="nt"></configurations></span>
<span class="nt"></unicorn></span>
<span class="nt"></sitecore></span>
<span class="nt"></configuration></span>
</code></pre></div></div>
<h3 id="items-include---all-items-from-a-configuration">Items include - all items from a configuration</h3>
<p>Now let’s say that I want to build a package and include all those items into a package.</p>
<p>I will have to create a new configuration for that.</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><configuration</span> <span class="na">xmlns:patch=</span><span class="s">"http://www.sitecore.net/xmlconfig/"</span><span class="nt">></span>
<span class="nt"><sitecore></span>
<span class="nt"><packaging></span>
<span class="c"><!--
Include all items from configuration 'Sitecore.Utilities.Feature.UnicornPackaging.Example'
Use 'Overwrite' as an install option
--></span>
<span class="nt"><configuration</span> <span class="na">name=</span><span class="s">"UnicornPackaging.Example.OverwriteEveryItem"</span> <span class="na">unicornConfiguration=</span><span class="s">"Sitecore.Utilities.Feature.UnicornPackaging.Example"</span><span class="nt">></span>
<span class="nt"><unicorn</span> <span class="na">include=</span><span class="s">"*"</span> <span class="na">install=</span><span class="s">"Overwrite"</span><span class="nt">/></span>
<span class="nt"></configuration></span>
<span class="nt"></packaging></span>
<span class="nt"></sitecore></span>
<span class="nt"></configuration></span>
</code></pre></div></div>
<p>There is a new section <code class="language-plaintext highlighter-rouge"><packaging></code> in a configuration (an equivalent of <code class="language-plaintext highlighter-rouge">unicorn</code> node)</p>
<p>Next, we will just store a set of <code class="language-plaintext highlighter-rouge">configuration</code> nodes nested under <code class="language-plaintext highlighter-rouge">packaging</code>.</p>
<p>Each configuration node can include many things.</p>
<p>In this example, there is a single node called <code class="language-plaintext highlighter-rouge"><unicorn></code>. It’s responsible for including <code class="language-plaintext highlighter-rouge">include</code> node/nodes from particular unicorn configuration.</p>
<p>How does it know which one? Take a look at the configuration node, there is an attribute <code class="language-plaintext highlighter-rouge">unicornConfiguration</code>. You have to define which Unicorn configuration corresponds to this packaging configuration.</p>
<p><strong>Install</strong> attribute in <code class="language-plaintext highlighter-rouge"><unicorn></code> node defines an installation option that you already know from Sitecore (<code class="language-plaintext highlighter-rouge">Merge</code>, <code class="language-plaintext highlighter-rouge">Overwrite</code>, <code class="language-plaintext highlighter-rouge">Skip</code>, <code class="language-plaintext highlighter-rouge">Ask User</code>), of course there is also <strong>Merge</strong> (not used here).</p>
<p><strong>Asterisk</strong> in <code class="language-plaintext highlighter-rouge">include</code> attribute means that it will include everything under predicate. This is cool because you can define packaging configuration once and even if you add new items/includes to Unicorn they will be automatically added to the package.</p>
<h3 id="items-include---define-installation-options">Items include - define installation options</h3>
<p>If for some reason you need to treat items separately that’s not a problem, see an example below</p>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><configuration</span> <span class="na">xmlns:patch=</span><span class="s">"http://www.sitecore.net/xmlconfig/"</span><span class="nt">></span>
<span class="nt"><sitecore></span>
<span class="c"><!--
Include items from configuration 'Sitecore.Utilities.Feature.UnicornPackaging.Example'
Add include named 'Content' with Merge/Merge options
Add include named 'Template' with Overwrite option
--></span>
<span class="nt"><configuration</span> <span class="na">name=</span><span class="s">"UnicornPackaging.Example.InstallOptions"</span> <span class="na">unicornConfiguration=</span><span class="s">"Sitecore.Utilities.Feature.UnicornPackaging.Example"</span><span class="nt">></span>
<span class="nt"><unicorn</span> <span class="na">include=</span><span class="s">"Content"</span> <span class="na">install=</span><span class="s">"Merge"</span> <span class="na">Merge=</span><span class="s">"Merge"</span> <span class="nt">/></span>
<span class="nt"><unicorn</span> <span class="na">include=</span><span class="s">"Template"</span> <span class="na">install=</span><span class="s">"Overwrite"</span><span class="nt">/></span>
<span class="nt"></configuration></span>
<span class="nt"></packaging></span>
<span class="nt"></sitecore></span>
<span class="nt"></configuration></span>
</code></pre></div></div>
<p>Instead of including everything, I defined <code class="language-plaintext highlighter-rouge">Template</code> to be installed with <strong>Overwrite</strong> option and <code class="language-plaintext highlighter-rouge">Content</code> to be installed with <strong>Merge/Merge</strong></p>
<h3 id="files-include">Files include</h3>
<p>Now, you will learn how to include something from the filesystem.</p>
<p>There are two additional nodes:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">file</code> - to a include single file, a path is relative to a website folder,</li>
<li><code class="language-plaintext highlighter-rouge">dir</code> - to include the whole directory recursively</li>
</ul>
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><configuration</span> <span class="na">xmlns:patch=</span><span class="s">"http://www.sitecore.net/xmlconfig/"</span><span class="nt">></span>
<span class="nt"><sitecore></span>
<span class="c"><!--
Include files and directories
Include 'Newtonsoft.Json.dll' from bin folder
Include all content under 'Website\App_Config\Modules\Sitecore.Utilities'
--></span>
<span class="nt"><configuration</span> <span class="na">name=</span><span class="s">"UnicornPackaging.Example.FileSystem"</span><span class="nt">></span>
<span class="nt"><file</span> <span class="na">path=</span><span class="s">"bin\Newtonsoft.Json.dll"</span> <span class="na">install=</span><span class="s">"Overwrite"</span><span class="nt">/></span>
<span class="nt"><dir</span> <span class="na">path=</span><span class="s">"App_Config\Modules\Sitecore.Utilities"</span> <span class="na">install=</span><span class="s">"Overwrite"</span><span class="nt">/></span>
<span class="nt"></configuration></span>
<span class="nt"></packaging></span>
<span class="nt"></sitecore></span>
<span class="nt"></configuration></span>
</code></pre></div></div>
<p>The same as with <code class="language-plaintext highlighter-rouge">include</code> nodes you can use installation options here as well.</p>
<h3 id="packaging">Packaging</h3>
<p>Now the most important thing. How to package all those configurations?</p>
<p>This is a script that I used to prepare a package with this utility.</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Import-Function</span><span class="w"> </span><span class="nx">Get-Package</span><span class="w"> </span><span class="nt">-Module</span><span class="w"> </span><span class="s2">"UnicornPackaging"</span><span class="w">
</span><span class="nv">$packageName</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Sitecore.Utilities.Feature.UnicornPackaging"</span><span class="w">
</span><span class="p">[</span><span class="n">string</span><span class="p">[]]</span><span class="nv">$include</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Sitecore.Utilities.Feature.UnicornPackaging.Packaging"</span><span class="p">,</span><span class="w"> </span><span class="s2">"Sitecore.Utilities.Foundation.Serialization.Packaging"</span><span class="w">
</span><span class="c"># Get all package configurations</span><span class="w">
</span><span class="p">[</span><span class="n">System.Xml.XmlNode</span><span class="p">[]]</span><span class="nv">$allPackageConfigurationConfigs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Sitecore.Configuration.Factory</span><span class="p">]::</span><span class="n">GetConfigNodes</span><span class="p">(</span><span class="s2">"/sitecore/packaging/configuration"</span><span class="p">)</span><span class="w">
</span><span class="c"># Filter package configurations</span><span class="w">
</span><span class="nv">$allPackageConfigurationConfigs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">$allPackageConfigurationConfigs</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="nf">?</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nv">$include</span><span class="o">.</span><span class="nf">Contains</span><span class="p">(</span><span class="bp">$_</span><span class="o">.</span><span class="nf">Name</span><span class="p">)</span><span class="w"> </span><span class="o">-eq</span><span class="w"> </span><span class="bp">$true</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="c"># List Configurations</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"Generating package with following packaging configurations:"</span><span class="w">
</span><span class="nv">$allPackageConfigurationConfigs</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="p">{</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`t</span><span class="si">$(</span><span class="bp">$_</span><span class="o">.</span><span class="nf">Name</span><span class="si">)</span><span class="s2">"</span><span class="p">}</span><span class="w">
</span><span class="c"># Generate package</span><span class="w">
</span><span class="nv">$start</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Date</span><span class="w">
</span><span class="nv">$package</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Package</span><span class="w"> </span><span class="nv">$allPackageConfigurationConfigs</span><span class="w">
</span><span class="nv">$package</span><span class="o">.</span><span class="nf">Metadata</span><span class="o">.</span><span class="nf">PackageName</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">$packageName</span><span class="w">
</span><span class="nv">$package</span><span class="o">.</span><span class="nf">Metadata</span><span class="o">.</span><span class="nf">Author</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Alan Płócieniak"</span><span class="w">
</span><span class="nv">$package</span><span class="o">.</span><span class="nf">Metadata</span><span class="o">.</span><span class="nf">Version</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"1.0"</span><span class="w">
</span><span class="nv">$package</span><span class="o">.</span><span class="nf">Name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">$packageName</span><span class="w">
</span><span class="nv">$start</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Date</span><span class="w">
</span><span class="nx">Export-Package</span><span class="w"> </span><span class="nt">-Project</span><span class="w"> </span><span class="nv">$package</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="s2">"</span><span class="si">$(</span><span class="nv">$SitecorePackageFolder</span><span class="si">)</span><span class="s2">\</span><span class="si">$(</span><span class="nv">$packageName</span><span class="si">)</span><span class="s2">.zip"</span><span class="w"> </span><span class="nt">-Zip</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"Package generated [</span><span class="si">$(</span><span class="p">((</span><span class="n">Get-Date</span><span class="p">)</span><span class="o">-</span><span class="nv">$start</span><span class="si">)</span><span class="s2">.Milliseconds) ms]"</span><span class="w">
</span></code></pre></div></div>
<h3 id="installation">Installation</h3>
<p>Download package from here:
<a href="/files/posts/unicorn-packaging/Sitecore.Utilities.Feature.UnicornPackaging.zip">
Sitecore.Utilities.Feature.UnicornPackaging.zip
</a></p>
<p>This is standard Sitecore package.</p>
<h1 id="summary">Summary</h1>
<p>Now you can use <strong>Web API</strong> from <strong>SPE</strong> and build packages from Sitecore very easily.</p>
<p>There is an easier alternative (<a href="https://kamsar.net/index.php/2017/02/Unicorn-4-Preview-Part-2-5-Generating-Packages-with-SPE/">Unicorn-4-Preview-Part-2-5-Generating-Packages-with-SPE</a>), however, it does not provide all the features which <strong>UnicornPackaging</strong> does.</p>
<p>If you are interested in more utilities like that you should start <a href="https://github.com/alan-null/Sitecore.Utilities">Sitecore.Utilities</a> project on Github.</p>
<p>I am going to prepare a download page there so you will be able to find all things in one place.</p>
<p><a href="https://alan-null.github.io/2019/01/unicorn-packaging">Sitecore Utilities: Unicorn Packaging</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on January 29, 2019.</p>
https://alan-null.github.io/2018/10/sxa-health-check2018-10-22T00:00:00+02:002018-10-22T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Scan your SXA solutions and find out if there are no problems. <!--more--></p>
<h1 id="introduction">Introduction</h1>
<p>I help people to solve their problems with <strong>SXA</strong> 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.</p>
<p>I was thinking about something that could help diagnose problems on remote instances for a long time.</p>
<p>I already wrote some <a href="https://marketplace.sitecore.net/en/Modules/Sitecore_PowerShell_console.aspx"><strong>PowerShell</strong></a> scripts which I shared with the community to scan content and find problematic items.</p>
<p>Finally, I decided to do something more. I present you <strong>SXA Health Check</strong></p>
<h1 id="sxa-health-check">SXA Health Check</h1>
<h2 id="tldr">TL;DR</h2>
<p>If you ever used <strong>PowerShell</strong> in <strong>SXA</strong>, you will know what to do, <a href="https://github.com/alan-null/SXA.HealthCheck"><strong>SXA Health Check</strong></a></p>
<h2 id="about">About</h2>
<p><strong>SXA Health Check</strong> is a PowerShell script.</p>
<p>Right. One big script (at least for now).</p>
<p>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.</p>
<h2 id="sxa-support">SXA support</h2>
<p>Right now it should work for <strong>SXA 1.4</strong> and above. I don’t think I will try to support earlier versions.</p>
<p>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 <a href="//github.com/alan-null/SXA.HealthCheck/issues/new">here</a>.</p>
<h2 id="usage">Usage</h2>
<h3 id="executing">Executing</h3>
<ol>
<li>Go to <a href="https://github.com/alan-null/SXA.HealthCheck"><strong>SXA.HealthCheck</strong></a> repository</li>
<li>Open the latest version of <a href="https://raw.githubusercontent.com/alan-null/SXA.HealthCheck/master/main.ps1"><strong>main.ps1</strong></a></li>
<li>Copy content to a clipboard</li>
<li>Open PowerShell ISE (<code class="language-plaintext highlighter-rouge">http://domain/sitecore/shell/Applications/PowerShell/PowerShellIse?sc_bw=1</code>)</li>
<li>Paste content from a clipboard</li>
<li>Set <strong>Context item</strong> to your site (for example <code class="language-plaintext highlighter-rouge">/sitecore/content/F/Validation/V</code>). If you are not familiar with ISE you can read more <a href="https://doc.sitecorepowershell.com/interfaces/scripting">here</a></li>
<li>Execute script</li>
</ol>
<p>Steps will be executed one by one and you will see continuous results on the console.</p>
<p><a href="/images/posts/sxa-health-check/console.png" class="img-container">
<img src="/images/posts/sxa-health-check/console.png" />
</a></p>
<p>Once the whole procedure is done you will see List View with validation results</p>
<p><a href="/images/posts/sxa-health-check/list-view.png" class="img-container">
<img src="/images/posts/sxa-health-check/list-view.png" />
</a></p>
<h3 id="reading-results">Reading results</h3>
<p>There are 3 possible results of validation:</p>
<ul>
<li><strong>OK</strong> - you can celebrate, a validation step was successful,</li>
<li><strong>Warning</strong> - 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,</li>
<li><strong>Error</strong> - steps with this type of result must be solved.</li>
</ul>
<p>For <strong>Error</strong> and <strong>Warning</strong> you will see message in the 4th column. It describes the problem and suggests what you could do to solve it</p>
<h1 id="code">Code</h1>
<p>The script contains a collection of validation steps defined inside. Each validation step has a similar structure to this:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">@{</span><span class="w">
</span><span class="nx">Title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Validation step name"</span><span class="p">;</span><span class="w">
</span><span class="nx">Description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Validation step description."</span><span class="p">;</span><span class="w">
</span><span class="nx">Version</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">@{</span><span class="w">
</span><span class="nx">From</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1400</span><span class="p">;</span><span class="w"> </span><span class="c"># SXA version from which step can be executed</span><span class="w">
</span><span class="nx">To</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"*"</span><span class="p">;</span><span class="w"> </span><span class="c"># SXA version to which step can be executed</span><span class="w">
</span><span class="p">};</span><span class="w">
</span><span class="nx">Script</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="c"># validation script content</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<p>As you can see not every step will be executed if validated feature is not available on your SXA version.</p>
<h1 id="summary">Summary</h1>
<p>It’s just a beginning.</p>
<p>There are not too many steps right now (only 10) but I defined a structure and now it will be easier to move forward.</p>
<p>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).</p>
<p>If you have interesting ideas on how I could make this tool better let me know on twitter <a href="//twitter.com/alanploc">@AlanPloc</a> or slack <strong>@alan</strong></p>
<p><a href="https://alan-null.github.io/2018/10/sxa-health-check">SXA Health Check</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on October 22, 2018.</p>
https://alan-null.github.io/2018/09/sxa-scaffolding-automation2018-09-19T00:00:00+02:002018-09-19T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Learn how to automate site/tenant creation with PowerShell scripts <!--more--></p>
<h1 id="introduction">Introduction</h1>
<p>If you ever <a href="https://doc.sitecore.net/sitecore_experience_accelerator/setting_up_and_configuring/configuring/create_a_tenant_and_a_site">created a site or tenant</a> in <a href="https://github.com/alan-null/SXA.Index#----sitecore-experience-accelerator----index"><strong>SXA</strong></a> you probably know this dialog</p>
<p><a href="/images/posts/scaffolding-automation/new-tenant.png" class="img-container">
<img src="/images/posts/scaffolding-automation/new-tenant.png" />
</a></p>
<p>Did you know that all scaffolding dialogs were created with <a href="https://marketplace.sitecore.net/en/Modules/Sitecore_PowerShell_console.aspx"><strong>Sitecore Powershell Extensions</strong></a>?</p>
<p>The fact that scaffolding use PowerShell to <a href="https://doc.sitecore.net/sitecore_experience_accelerator/setting_up_and_configuring/configuring/create_a_tenant_and_a_site">create sites and tenants</a> is a great news for us.</p>
<p>This means that we can very easy automate this process!</p>
<h1 id="powershell-power">Powershell power</h1>
<h2 id="script-source">Script source</h2>
<p>You can find code here:</p>
<p><a href="https://github.com/PowerShellLibrary/Sitecore/blob/master/SXA/Scaffolding/New-SxaSite.ps1"><strong>New-SxaSite.ps1</strong></a></p>
<p>There are three sections:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">variables</code> - you can set different values. If you invoke it in a loop you can change for example site name (<em>S1</em>, <em>S2</em>, …),</li>
<li><code class="language-plaintext highlighter-rouge">create - new tenant</code> - creates a tenant with default settings,</li>
<li><code class="language-plaintext highlighter-rouge">create - new site</code> - creates a site with default settings</li>
</ul>
<p>Script will create a tenant folder <strong>F</strong>.</p>
<p>Under <strong>F</strong> folder a new tenant <strong>T</strong> with site <strong>S</strong> will be created</p>
<p>Tenant and site will be created with all default features (modules which are marked as <code class="language-plaintext highlighter-rouge">Include by default</code>).</p>
<p><a href="/images/posts/scaffolding-automation/include-by-default.png" class="img-container">
<img src="/images/posts/scaffolding-automation/include-by-default.png" />
</a></p>
<h2 id="bonus---cleanup">Bonus - cleanup</h2>
<p>If you need to remove a tenant folder you can use this snippet</p>
<figure class="highlight"><pre><code class="language-powershell" data-lang="powershell"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
</pre></td><td class="code"><pre><span class="n">Import-Function</span><span class="w"> </span><span class="nx">Remove-TenantFolder</span><span class="w">
</span><span class="nv">$contentPath</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"master:/content/F"</span><span class="w">
</span><span class="nv">$folder</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Item</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="nv">$contentPath</span><span class="w">
</span><span class="n">Remove-TenantFolder</span><span class="w"> </span><span class="nv">$folder</span>
</pre></td></tr></tbody></table></code></pre></figure>
<p>What is the point of removing it this way? Script will take care of everything. It will not only remove content items but also templates and media library.</p>
<p>There are other cmdlets that you can use as well.</p>
<figure class="highlight"><pre><code class="language-powershell" data-lang="powershell"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
</pre></td><td class="code"><pre><span class="n">Import-Function</span><span class="w"> </span><span class="nx">Remove-TenantFolder</span><span class="w">
</span><span class="n">Import-Function</span><span class="w"> </span><span class="nx">Remove-Tenant</span><span class="w">
</span><span class="n">Import-Function</span><span class="w"> </span><span class="nx">Remove-Site</span>
</pre></td></tr></tbody></table></code></pre></figure>
<p><a href="https://alan-null.github.io/2018/09/sxa-scaffolding-automation">SXA - create sites/tenants with SPE</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on September 19, 2018.</p>
https://alan-null.github.io/2017/12/sxa-blog2017-12-14T00:00:00+01:002017-12-14T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Learn how to create a blog using <strong>Sitecore Experience Accelerator</strong> with out of the box functionalities. <!--more--></p>
<h1 id="table-of-contents"><a name="toc" href="#"></a>Table of contents</h1>
<ul>
<li><a href="#site">Site</a></li>
<li><a href="#templates">Templates</a>
<ul>
<li><a href="#template-blog-post">Blog Post template</a></li>
<li><a href="#template-blog-home">Blog Home template</a></li>
</ul>
</li>
<li><a href="#content">Content</a></li>
<li><a href="#item-queries">Item Queries</a></li>
<li><a href="#presentation">Presentation</a>
<ul>
<li><a href="#partial-designs">Partial Designs</a>
<ul>
<li><a href="#blog-base-partial-design">Blog Base Partial Design</a></li>
<li><a href="#blog-home-partial-design">Blog Home Partial Design</a></li>
<li><a href="#blog-post-partial-design">Blog Post Partial Design</a></li>
</ul>
</li>
<li><a href="#page-designs">Page Designs</a>
<ul>
<li><a href="#blog-post-page-design">Blog Post Page Design</a></li>
<li><a href="#blog-home-page-design">Blog Home Page Design</a></li>
</ul>
</li>
<li><a href="#template-mapping">Template mapping</a></li>
</ul>
</li>
<li><a href="#search-results-page">Search results page</a></li>
<li><a href="#demo">Demo</a>
<ul>
<li><a href="#package">Package</a></li>
</ul>
</li>
<li><a href="#faq">FAQ</a></li>
</ul>
<hr />
<h1 id="site-">Site <a name="site" href="#"></a><a href="#toc"><sup>↑</sup></a></h1>
<p>This step is optional. You can already have your own site and just want to extend it with blog features. I will create a separate site to not mix items from <a href="https://github.com/alan-null/XA.Reference/releases">XA.Reference</a> site.</p>
<p>It will look like this</p>
<p><a href="/images/posts/sxa-blog/content-blog-site.png" class="img-container">
<img src="/images/posts/sxa-blog/content-blog-site.png" />
</a></p>
<h1 id="templates-">Templates <a name="templates" href="#"></a><a href="#toc"><sup>↑</sup></a></h1>
<p>In this section templates for blog items which will be used in next paragraphs will be created.</p>
<p>Templates will be created under <em>Tenant Templates</em> folder, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/templates/Project/SXA Reference/Blog</code>)</p>
<h3 id="blog-post-template-">Blog Post template <a name="template-blog-post" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<ul>
<li>Go to <em>Tenant Templates</em></li>
<li>Create new template, give it a name: <strong>Blog Post</strong></li>
<li>Set base template to a Page template from your <em>Tenant Templates</em>, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/templates/Project/SXA Reference/Blog/Page</code>)</li>
<li>Add two additional fields under <em>Content</em> section
<ul>
<li><strong>Introduction</strong> field (type: <code class="language-plaintext highlighter-rouge">Rich Text</code>)</li>
<li><strong>Published</strong> field (type: <code class="language-plaintext highlighter-rouge">Datetime</code>) <a name="field-published" href="#"></a></li>
</ul>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/template-blog-post.png" class="img-container">
<img src="/images/posts/sxa-blog/template-blog-post.png" />
</a></p>
<ul>
<li>Add <em>Standard Values</em> item</li>
<li>Set <code class="language-plaintext highlighter-rouge">__Bucketable</code> field to true</li>
</ul>
<p><a href="/images/posts/sxa-blog/template-blog-post-sv.png" class="img-container">
<img src="/images/posts/sxa-blog/template-blog-post-sv.png" />
</a></p>
<ul>
<li>Fill <code class="language-plaintext highlighter-rouge">Title</code> field with <code class="language-plaintext highlighter-rouge">$name</code> token</li>
<li>Fill <code class="language-plaintext highlighter-rouge">Published</code> field with <code class="language-plaintext highlighter-rouge">$now</code> token</li>
</ul>
<h3 id="blog-home-template-">Blog Home template <a name="template-blog-home" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<ul>
<li>Go to <em>Tenant Templates</em></li>
<li>Create new template, give it a name: <strong>Blog Home</strong></li>
<li>Set base template to <strong>Page</strong> template from your <em>Tenant Templates</em>, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/templates/Project/SXA Reference/Blog/Page</code>)</li>
</ul>
<p><a href="/images/posts/sxa-blog/template-blog-home.png" class="img-container">
<img src="/images/posts/sxa-blog/template-blog-home.png" />
</a></p>
<ul>
<li>Add <em>Standard Values</em> item</li>
<li>Edit <code class="language-plaintext highlighter-rouge">__Masters</code> field (<em>Insert Options</em>) - add <strong>Blog Post</strong> template to insert options</li>
</ul>
<p><a href="/images/posts/sxa-blog/template-blog-home-insert-options.png" class="img-container">
<img src="/images/posts/sxa-blog/template-blog-home-insert-options.png" />
</a></p>
<ul>
<li>Set <code class="language-plaintext highlighter-rouge">__Is Bucket</code> field to <strong>true</strong></li>
</ul>
<p><a href="/images/posts/sxa-blog/template-blog-home-sv.png" class="img-container">
<img src="/images/posts/sxa-blog/template-blog-home-sv.png" />
</a></p>
<h1 id="content-">Content <a name="content" href="#"></a><a href="#toc"><sup>↑</sup></a></h1>
<p>Now when we have our templates we can create example content</p>
<ul>
<li>Got to location where you want to create your blog</li>
<li>Create blog root item using <strong>Blog Home</strong> template <a name="blog-root" href="#"></a></li>
</ul>
<p><a href="/images/posts/sxa-blog/content-blog-root.png" class="img-container">
<img src="/images/posts/sxa-blog/content-blog-root.png" />
</a></p>
<ul>
<li>Create some blog posts so we can see if our presentation looks fine in next sections</li>
</ul>
<p><a href="/images/posts/sxa-blog/content-blog-pages.png" class="img-container">
<img src="/images/posts/sxa-blog/content-blog-pages.png" />
</a></p>
<h1 id="item-queries-">Item Queries <a name="item-queries" href="#"></a><a href="#toc"><sup>↑</sup></a></h1>
<p>Before we start defining presentation we will configure <em>Item Query</em>, which will return blog posts for a given blog root. I will be a data source for some of the renderings.</p>
<ul>
<li>Go to <em>Item Queries</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Settings/Item Queries</code>)</li>
<li>Create <em>Item Query</em>, give it a name: <strong>Blog Post</strong> <a name="item-query" href="#"></a></li>
</ul>
<p><a href="/images/posts/sxa-blog/item-query-ce.png" class="img-container">
<img src="/images/posts/sxa-blog/item-query-ce.png" />
</a></p>
<ul>
<li>Click <strong>Build Query</strong> (button located in <code class="language-plaintext highlighter-rouge">Query</code> field)</li>
<li>Create query:
<ul>
<li>Set <code class="language-plaintext highlighter-rouge">Location</code> filter - select blog root item created <a href="#content">here</a></li>
<li>Set <code class="language-plaintext highlighter-rouge">Template</code> filter - select <strong>Blog Post</strong> template created <a href="#template-blog-post">here</a></li>
<li>Set <code class="language-plaintext highlighter-rouge">Sort</code> - select <strong>Published</strong> field create <a href="#field-published">here</a></li>
</ul>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/item-query-editor.png" class="img-container">
<img src="/images/posts/sxa-blog/item-query-editor.png" />
</a></p>
<h1 id="presentation-">Presentation <a name="presentation" href="#"></a><a href="#toc"><sup>↑</sup></a></h1>
<p>In this section we will take care of look and feel of your blog. We will create: <em>Partial Designs</em>, <em>Page Designs</em> and <em>Rendering Variants</em>.</p>
<h3 id="partial-designs-">Partial Designs <a name="partial-designs" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<h3 id="blog-base-partial-design-">Blog Base Partial Design <a name="blog-base-partial-design" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<p>This will be base <em>Partial Design</em> for our <strong>Blog Home Partial Design</strong> and <strong>Blog Post Partial Design</strong></p>
<ul>
<li>Go to <em>Partial Designs</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Partial Designs</code>)</li>
<li>Create <em>Partial Design</em>, give it a name: <strong>Blog Base</strong></li>
<li>Open it in <em>Experience Editor</em></li>
<li>Split <code class="language-plaintext highlighter-rouge">main</code> placeholder
<ul>
<li>Add <em>Column Splitter</em> rendering into <code class="language-plaintext highlighter-rouge">main</code> placeholder and</li>
<li>Set <strong>1st</strong> column width to <strong>8</strong></li>
<li>Set <strong>2nd</strong> column width to <strong>4</strong></li>
</ul>
</li>
<li>Add sidebar renderings
<ul>
<li>Add <em>Rich Text</em> rendering into <code class="language-plaintext highlighter-rouge">column-2-1</code>, set its content to: <strong>Archive</strong> (this will be header text for <em>Archive</em> rendering)</li>
<li>Add <em>Archive</em> rendering into <code class="language-plaintext highlighter-rouge">column-2-1</code></li>
<li>Add <em>Rich Text</em> rendering into <code class="language-plaintext highlighter-rouge">column-2-1</code>, set its content to: <strong>Tag Cloud</strong> (this will be header text for <em>Tag Cloud</em> rendering)</li>
<li>Add <em>Tag Cloud</em> rendering into <code class="language-plaintext highlighter-rouge">column-2-1</code></li>
</ul>
</li>
</ul>
<p>You should obtain a similar result.</p>
<ul>
<li>
<h3 id="experience-editor"><em>Experience Editor</em></h3>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/partial-blog-base-ee.png" class="img-container">
<img src="/images/posts/sxa-blog/partial-blog-base-ee.png" />
</a></p>
<ul>
<li>
<h3 id="content-editor"><em>Content Editor</em></h3>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/partial-blog-base-ce.png" class="img-container">
<img src="/images/posts/sxa-blog/partial-blog-base-ce.png" />
</a></p>
<ul>
<li>Configure <em>Archive</em>
<ul>
<li>Open rendering parameters for <em>Archive</em> rendering</li>
<li>Set <code class="language-plaintext highlighter-rouge">Source Type</code> field - assign <strong>Blog Posts</strong> <em>Item Query</em> created <a href="#item-query">here</a></li>
<li>Set <code class="language-plaintext highlighter-rouge">Name of the field used for date:</code> field - set <strong>Published</strong> field created <a href="#field-published">here</a></li>
</ul>
</li>
<li>Configure <em>Tag Cloud</em>
<ul>
<li>Open rendering parameters for <em>Tag Cloud</em> rendering</li>
<li>Set <code class="language-plaintext highlighter-rouge">Data Source</code> field - assign blog root item created <a href="#blog-root">here</a> (this will be root to take tags from)</li>
<li>Set <code class="language-plaintext highlighter-rouge">Facet</code> field - assign <code class="language-plaintext highlighter-rouge">SxaTags</code> field (this is the default tagging field which comes with <strong>Taxonomy</strong> feature)</li>
<li>Set <code class="language-plaintext highlighter-rouge">Search Result Page</code> field - page where search results will be presented, see how to create serach results page <a href="#search-results-page">here</a></li>
</ul>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/partial-blog-base-ee-configured.png" class="img-container">
<img src="/images/posts/sxa-blog/partial-blog-base-ee-configured.png" />
</a></p>
<h3 id="blog-home-partial-design-">Blog Home Partial Design <a name="blog-home-partial-design" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<ul>
<li>Go to <em>Partial Designs</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Partial Designs</code>)</li>
<li>Create <em>Partial Design</em>, give it a name: <strong>Blog Home</strong></li>
<li>Set <code class="language-plaintext highlighter-rouge">Base Partial Design</code> field to previously created base <em>Partial Design</em>, <code class="language-plaintext highlighter-rouge">Partial Designs/Blog Base</code></li>
</ul>
<p><a href="/images/posts/sxa-blog/partial-blog-home-ce.png" class="img-container">
<img src="/images/posts/sxa-blog/partial-blog-home-ce.png" />
</a></p>
<ul>
<li>Open it in <em>Experience Editor</em></li>
<li>
<p>Add <em>Page List</em> rendering into <code class="language-plaintext highlighter-rouge">column-1-1</code></p>
</li>
<li>Create <em>Rendering Variant</em> for <em>Page List</em>
<ul>
<li>Go to <em>Rendering Variants</em> root for <em>Page List</em> (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Rendering Variants/Page List</code>)</li>
<li>Create new variant <strong>Post List</strong>
<ul>
<li><code class="language-plaintext highlighter-rouge">Title</code> field (<code class="language-plaintext highlighter-rouge">VariantField</code> type)
<ul>
<li>Change tag to <code class="language-plaintext highlighter-rouge">h2</code></li>
<li>Set <code class="language-plaintext highlighter-rouge">Is link</code> field to <strong>true</strong></li>
</ul>
</li>
<li><code class="language-plaintext highlighter-rouge">Published</code> field (<code class="language-plaintext highlighter-rouge">VariantDateField</code> type)</li>
<li><code class="language-plaintext highlighter-rouge">Introduction</code> field (<code class="language-plaintext highlighter-rouge">VariantField</code> type)</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/variant-post-list.png" class="img-container">
<img src="/images/posts/sxa-blog/variant-post-list.png" />
</a></p>
<ul>
<li>Go back to <em>Experience Editor</em></li>
<li>Assign newly created <strong>Post List</strong> variant to <em>Page List</em> rendering</li>
</ul>
<p><a href="/images/posts/sxa-blog/partial-blog-home-ee.png" class="img-container">
<img src="/images/posts/sxa-blog/partial-blog-home-ee.png" />
</a></p>
<ul>
<li>Add <em>Pagination</em> rendering into <code class="language-plaintext highlighter-rouge">column-1-1</code> (under <em>Page List</em>)</li>
<li>Configure <em>Pagination</em>
<ul>
<li>Open rendering parameters for <em>Pagination</em> rendering</li>
<li>Set <code class="language-plaintext highlighter-rouge">List Signature</code> field - assign <strong>blog-post-list</strong></li>
</ul>
</li>
<li>Configure <em>Page List</em>
<ul>
<li>Open rendering parameters for <em>Page List</em> rendering</li>
<li>Set <code class="language-plaintext highlighter-rouge">List Signature</code> field - assign <strong>blog-post-list</strong></li>
<li>Set <code class="language-plaintext highlighter-rouge">Source Type</code> field - assign <strong>Blog Posts</strong> <em>Item Query</em> created <a href="#item-query">here</a></li>
<li>[Optional] Set <code class="language-plaintext highlighter-rouge">Page Size</code> field - set number of posts that should be displayed on blog home item</li>
</ul>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/partial-blog-home-ee-configured.png" class="img-container">
<img src="/images/posts/sxa-blog/partial-blog-home-ee-configured.png" />
</a></p>
<h3 id="blog-post-partial-design-">Blog Post Partial Design <a name="blog-post-partial-design" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<ul>
<li>Go to <em>Partial Designs</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Partial Designs</code>)</li>
<li>Create <em>Partial Design</em>, give it a name: <strong>Blog Post</strong></li>
<li>Set <code class="language-plaintext highlighter-rouge">Base Partial Design</code> field to previously created base <em>Partial Design</em>, <code class="language-plaintext highlighter-rouge">Partial Designs/Blog Base</code></li>
</ul>
<p><a href="/images/posts/sxa-blog/partial-blog-post-ce.png" class="img-container">
<img src="/images/posts/sxa-blog/partial-blog-post-ce.png" />
</a></p>
<ul>
<li>Open it in <em>Experience Editor</em></li>
<li>Add <em>Page Content</em> rendering into <code class="language-plaintext highlighter-rouge">column-1-1</code></li>
<li>Create <em>Rendering Variant</em> for <em>Page Content</em>
<ul>
<li>Go to <em>Rendering Variants</em> root for <em>Page Content</em> (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Rendering Variants/Page Content</code>)</li>
<li>Create new variant <strong>Blog Post Entry</strong>
<ul>
<li><code class="language-plaintext highlighter-rouge">Title</code> field (<code class="language-plaintext highlighter-rouge">VariantField</code> type)
<ul>
<li>Change tag to <code class="language-plaintext highlighter-rouge">h1</code></li>
</ul>
</li>
<li><code class="language-plaintext highlighter-rouge">Published</code> field (<code class="language-plaintext highlighter-rouge">VariantDateField</code> type)</li>
<li><code class="language-plaintext highlighter-rouge">Introduction</code> field (<code class="language-plaintext highlighter-rouge">VariantField</code> type)</li>
<li><code class="language-plaintext highlighter-rouge">Content</code> field (<code class="language-plaintext highlighter-rouge">VariantField</code> type)</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/variant-post-entry.png" class="img-container">
<img src="/images/posts/sxa-blog/variant-post-entry.png" />
</a></p>
<ul>
<li>Go back to <em>Experience Editor</em></li>
<li>Assign newly created <strong>Blog Post Entry</strong> variant to <em>Page Content</em> rendering</li>
</ul>
<p><a href="/images/posts/sxa-blog/partial-blog-post-ee.png" class="img-container">
<img src="/images/posts/sxa-blog/partial-blog-post-ee.png" />
</a></p>
<ul>
<li>Add <em>Tag List</em> rendering into <code class="language-plaintext highlighter-rouge">column-1-1</code></li>
<li>Set <code class="language-plaintext highlighter-rouge">Search Result Page</code> field - page where search results will be presented, see how to create serach results page <a href="#search-results-page">here</a></li>
</ul>
<h3 id="page-designs-">Page Designs <a name="page-designs" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<h3 id="blog-post-page-design-">Blog Post Page Design <a name="blog-post-page-design" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<ul>
<li>Go to <em>Page Designs</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Page Designs</code>)</li>
<li>Create <em>Page Design</em>, give it a name: <strong>Blog Post</strong></li>
<li>Set <code class="language-plaintext highlighter-rouge">Partial Designs</code> field - add previously created <em>Partial Designs</em>: <strong>Blog Post</strong> (I also created <strong>Blog Footer</strong> and <strong>Blog Header</strong> for better content organization)</li>
</ul>
<p><a href="/images/posts/sxa-blog/design-post.png" class="img-container">
<img src="/images/posts/sxa-blog/design-post.png" />
</a></p>
<h3 id="blog-home-page-design-">Blog Home Page Design <a name="blog-home-page-design" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<ul>
<li>Go to <em>Page Designs</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Page Designs</code>)</li>
<li>Create <em>Page Design</em>, give it a name: <strong>Blog Home</strong></li>
<li>Set <code class="language-plaintext highlighter-rouge">Partial Designs</code> field - add previously created <em>Partial Designs</em>: <strong>Blog Home</strong> (I also created <strong>Blog Footer</strong> and <strong>Blog Header</strong> for better content organization)</li>
</ul>
<p><a href="/images/posts/sxa-blog/design-home.png" class="img-container">
<img src="/images/posts/sxa-blog/design-home.png" />
</a></p>
<h3 id="template-mapping-">Template mapping <a name="template-mapping" href="#"></a><a href="#toc"><sup>↑</sup></a></h3>
<p>After we created all <em>Page Designs</em> we can set mapping for them.</p>
<ul>
<li>Go to <em>Page Designs</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Page Designs</code>)</li>
<li>Set <code class="language-plaintext highlighter-rouge">Template Design Mapping</code> field
<ul>
<li>Map <strong>Blog Home</strong> <em>Page Design</em> to <strong>Blog Home</strong> template</li>
<li>Map <strong>Blog Post</strong> <em>Page Design</em> to <strong>Blog Post</strong> template</li>
</ul>
</li>
</ul>
<p><a href="/images/posts/sxa-blog/design-mapping.png" class="img-container">
<img src="/images/posts/sxa-blog/design-mapping.png" />
</a></p>
<h1 id="search-results-page-">Search results page <a name="search-results-page" href="#"></a><a href="#toc"><sup>↑</sup></a></h1>
<p>If you plan to use <em>Tag Cloud</em> or <em>Tag List</em> renderings you will have to create a page where serach results for particular tag will be presented.</p>
<p>There is nothing special with this page, the only required thing is <em>Search Results</em> rendering.</p>
<p>All necessary information about query criteria will be passed via URL.</p>
<p>See example</p>
<p><a href="/images/posts/sxa-blog/tag-cloud-redirect.gif" class="img-container">
<img src="/images/posts/sxa-blog/tag-cloud-redirect.png" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h2 id="advanced-configuration">Advanced configuration</h2>
<p>I present few additional steps that will make your search results page look better.</p>
<ul>
<li>Create <strong>Blog Base</strong> <em>Page Design</em>
<ul>
<li>Go to <em>Page Designs</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Page Designs</code>)</li>
<li>Create <em>Page Design</em>, give it a name: <strong>Blog Base</strong></li>
<li>Set <code class="language-plaintext highlighter-rouge">Partial Designs</code> field - add previously created <em>Partial Designs</em>: <strong>Blog Base</strong> (I also created <strong>Blog Footer</strong> and <strong>Blog Header</strong> for better content organization)</li>
</ul>
</li>
<li>Create your serach results page (you can use default <strong>Page</strong> template)</li>
<li>Assign <strong>Blog Base</strong> <em>Page Design</em> to search page</li>
</ul>
<p><a href="/images/posts/sxa-blog/search-page-blog-base.png" class="img-container">
<img src="/images/posts/sxa-blog/search-page-blog-base.png" />
</a></p>
<ul>
<li>Open it in <em>Experience Editor</em></li>
<li>Add <em>Search Results</em> rendering into <code class="language-plaintext highlighter-rouge">column-1-1</code> placeholder</li>
<li>Add <em>Load More</em> rendering into <code class="language-plaintext highlighter-rouge">column-1-1</code> placeholder</li>
</ul>
<p><a href="/images/posts/sxa-blog/search-page-ee.png" class="img-container">
<img src="/images/posts/sxa-blog/search-page-ee.png" />
</a></p>
<ul>
<li>Create <em>Rendering Variant</em> for <em>Search Results</em>
<ul>
<li>Go to <em>Rendering Variants</em> root for <em>Search Results</em> (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Presentation/Rendering Variants/Search Results</code>)</li>
<li>Copy existing variant created for <strong>Post List</strong> (you can create a new one, I am doing this for convenience)</li>
</ul>
</li>
<li>Go back to <em>Experience Editor</em> and assign variant.</li>
</ul>
<p>In order to avoid results from different location than blog root, so-called <em>Search Scope</em> has to be created.</p>
<ul>
<li>Go to <em>Scopes</em> root (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Settings/Scopes</code>)</li>
<li>Create new <em>Scope</em> item and name it: <strong>Blog Posts</strong></li>
<li>Set scope query (it is almost the same as one defined in item query but in this case omit sorting)</li>
</ul>
<p><a href="/images/posts/sxa-blog/search-scope.png" class="img-container">
<img src="/images/posts/sxa-blog/search-scope.png" />
</a></p>
<ul>
<li>Go back to <em>Experience Editor</em></li>
<li>Open rendering parameters for <em>Search Results</em> rendering</li>
<li>Assign <em>Search Scope</em></li>
</ul>
<p>One last missing part is sorting. To properly sort results follow steps below:</p>
<ul>
<li>Go to <em>Facets</em> root (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Settings/Facets</code>)</li>
<li>Create new <em>DateFacet</em> item and name it: <strong>Published</strong> (fields will be automatically set if you select correct name, otherwise make sure that field name for this facet equals <strong>Published</strong> date field created at the beginning.)</li>
<li>Go to <em>Sort Results</em> root for search renderings (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Data/Search/Sort Results</code>)</li>
<li>Create new <em>SortingGroup</em> item and name it: <strong>Published</strong></li>
<li>Add <em>Sorting</em> child and name it: <strong>Published Desc</strong>
<ul>
<li>Set <em>Facet</em> field to <strong>Published</strong> facet</li>
<li>Set <em>Direction</em> field to <strong>Descending</strong></li>
</ul>
</li>
<li>Go back to <em>Experience Editor</em></li>
<li>Open rendering parameters for <em>Search Results</em> rendering</li>
<li>Assign <em>Default sort order</em> (<strong>Published Descending</strong>)</li>
<li>[Optional] Set <code class="language-plaintext highlighter-rouge">Page Size</code> field - set number of posts that should be displayed by <em>Sort Results</em></li>
</ul>
<h1 id="demo-">Demo <a name="demo" href="#"></a><a href="#toc"><sup>↑</sup></a></h1>
<p>If you’ve done everything correctly you should achieve similar result.</p>
<p><a href="/images/posts/sxa-blog/demo.gif" class="img-container">
<img src="/images/posts/sxa-blog/tag-cloud-redirect.png" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<p>As you can see we haven’t touch Visual Studio at all. Everything happened in content. Simulating blog engine is just an example. There are a lot of other things that can do.</p>
<p>Once you learn using it and feel comfortable you will become a true magician.</p>
<h2 id="package-">Package <a name="package" href="#"></a><a href="#toc"><sup>↑</sup></a></h2>
<p>The tenant I’ve created for this tutorial can be found here: <a href="/files/posts/sxa-blog/SXA - Blog.zip"><strong>SXA - Blog.zip</strong></a></p>
<p>It is compatible with <a href="https://github.com/alan-null/SXA.Index#requirements-table">SXA 1.5</a>.</p>
<p>Updated version will be shipped with <a href="https://github.com/alan-null/XA.Reference/releases"><strong>XA.Reference</strong></a> site, starting from version <strong>5.0</strong> for <strong>SXA 1.6</strong></p>
<h1 id="faq-">FAQ <a name="faq" href="#"></a><a href="#toc"><sup>↑</sup></a></h1>
<h2 id="how-i-can-change-url-slug">How I can change URL slug?</h2>
<p>Blog posts URLs are generated based on the path in the content tree. I proposed the solution with blog root as a bucket item because it is easier to maintain URLs that way.</p>
<p>To change the way bucket path his build for blog posts follow steps below:</p>
<ul>
<li>Go to <em>Settings</em> node, in my case (<code class="language-plaintext highlighter-rouge">/sitecore/content/SXA Reference/Blog/blog/Settings</code>)</li>
<li>Set <code class="language-plaintext highlighter-rouge">Rule</code> field (<code class="language-plaintext highlighter-rouge">Rules for Resolving the Bucket Folder Path</code>) - configure rule and action. I recommend pointing to blog root using ID condition.</li>
</ul>
<p><a href="/images/posts/sxa-blog/bucket-settings.png" class="img-container">
<img src="/images/posts/sxa-blog/bucket-settings.png" />
</a></p>
<p>by default you’ve got following Bucketing options available:</p>
<p>Create the folder structure based on:</p>
<ul>
<li>the creation date of the new bucketable item in this format</li>
<li>the ID of the new bucketable item with this number of levels</li>
<li>the name of the new bucketable item with this number of levels</li>
<li>the tag with this as a default value</li>
</ul>
<h2 id="how-i-can-enable-comments">How I can enable comments?</h2>
<p>There are few ways to bring comments feature to your blog. Right now they have one in common, they are hosted on external services. Sitecore item-like comments are not delivered out of the box.</p>
<p>SXA provides two external integrations, you can see how they look like on the newest version of <strong>SXA</strong> here:</p>
<ul>
<li><a href="https://raw.githubusercontent.com/alan-null/XA.Reference.Wraith/master/shots_base/renderings_engagement_disqus/MULTI_casperjs_pattern.png">Disqus screenshot</a></li>
<li><a href="https://raw.githubusercontent.com/alan-null/XA.Reference.Wraith/master/shots_base/renderings_engagement_facebook-comments/MULTI_casperjs_pattern.png">Facebook Comments</a></li>
</ul>
<h2 id="how-i-can-enable-automatic-sync-of-a-bucket">How I can enable automatic sync of a bucket?</h2>
<p>Sitecore does not provide such feature by default. If you change field or property of your item that is an input for bucket path resolver you will have to manually synchronize tree.</p>
<p>If you need automatic bucket sync you will have to code one. See discussion on <a href="https://stackoverflow.com/a/32613206/6149877">stackoverflow</a> about this.</p>
<p><a href="https://alan-null.github.io/2017/12/sxa-blog">SXA - Blog</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on December 14, 2017.</p>
https://alan-null.github.io/2017/12/sxa-index2017-12-12T00:00:00+01:002017-12-12T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Find the most important/useful information about <strong>Sitecore Experience Accelerator</strong> in one place. <!--more--></p>
<h1 id="tldr">TL;DR</h1>
<p><a href="https://github.com/alan-null/SXA.Index#----sitecore-experience-accelerator----index">Sitecore Experience Accelerator Index</a></p>
<h1 id="goal">Goal</h1>
<p>The goal of <a href="https://github.com/alan-null/SXA.Index#----sitecore-experience-accelerator----index"><strong>SXA Index</strong></a> is to deliver the most important information for starters and provide an easy way to find necessary resources with a minimal number of clicks.</p>
<p>Having that in mind this page will not include links to any blog posts with how-to, tutorials or features description (at least for now).</p>
<h1 id="content">Content</h1>
<p>The content right now include:</p>
<ul>
<li><a href="https://github.com/alan-null/SXA.Index#downloads">Downloads</a> - direct links to SXA download pages,</li>
<li><a href="https://github.com/alan-null/SXA.Index#requirements">Requirements</a>
<ul>
<li><a href="https://github.com/alan-null/SXA.Index#requirements-table">Requirements table</a> - compatibility table for Sitecore Experience Platform, Sitecore Experience Accelerator, and Sitecore Powershell Extensions,</li>
<li><a href="https://github.com/alan-null/SXA.Index#raw-requirements">Raw requirements</a> - raw values from installation guide documents were copied to this section,</li>
</ul>
</li>
<li><a href="https://github.com/alan-null/SXA.Index#sites-running-sxa">Sites Running SXA</a> - list of sites running SXA, see the power of SXA in real life,</li>
<li><a href="https://github.com/alan-null/SXA.Index#demo-sites">Demo sites</a> - so-called reference sites. Those are demo sites with an example content which present features and teach how to use SXA.</li>
</ul>
<h1 id="summary">Summary</h1>
<p>I highly recommend you to bookmark this page. Whenever someone will ask a question that can be answered with <a href="https://github.com/alan-null/sc_ext"><strong>SXA Index</strong></a>, just share it.
I used many anchors on the page so you can easily link to a particular section.</p>
<p>If you’ve got an idea what else could be included on that page let me know or create a pull request/issue on GitHub.</p>
<p><a href="https://alan-null.github.io/2017/12/sxa-index">Sitecore Experience Accelerator Index</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on December 12, 2017.</p>
https://alan-null.github.io/2017/12/sxa-hotfix-upload-media-dialog2017-12-04T00:00:00+01:002017-12-04T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>How to solve the issue with <code class="language-plaintext highlighter-rouge">UploadMediaDialog</code> dialog while using <strong>Sitecore Experience Accelerator 1.5</strong> <!--more--></p>
<h2 id="problem-description">Problem description</h2>
<p>If you are using <strong>Sitecore Experience Accelerator 1.5</strong> you might notice problems with <code class="language-plaintext highlighter-rouge">UploadMediaDialog</code> dialog. When you try to change upload location nothing will happen and error will appear in the browser console.</p>
<p><a href="/images/posts/sxa-hotfix-upload-media-dialog/error.png" class="img-container">
<img src="/images/posts/sxa-hotfix-upload-media-dialog/error.png" />
</a></p>
<p><em>Console output:</em></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>UploadMediaDialog.js:17 Uncaught TypeError: Cannot read property 'viewModel' of undefined
at child.<anonymous> (http://sxa15/sitecore/shell/client/Applications/Dialogs/UploadMediaDialog.js:17:42)
at http://sxa15/sitecore/shell/client/Speak/Assets/lib/core/1.1/sitecore-1.0.2.js:1565:40
at Array.forEach (<anonymous>)
at Function._.each._.forEach (http://sxa15/sitecore/shell/client/Speak/Assets/lib/core/1.1/deps/underscore/underscore.1.4.4.js:78:11)
at child.click (http://sxa15/sitecore/shell/client/Speak/Assets/lib/core/1.1/sitecore-1.0.2.js:1563:13)
at Object.model.viewModel.(anonymous function) [as click] (http://sxa15/sitecore/shell/client/Speak/Assets/lib/core/1.1/sitecore-1.0.2.js:646:33)
at HTMLButtonElement.<anonymous> (http://sxa15/sitecore/shell/client/Speak/Assets/lib/core/1.1/deps/ko/knockout-2.2.1.js:2318:66)
at HTMLButtonElement.dispatch (http://sxa15/sitecore/shell/client/Speak/Assets/lib/core/1.1/deps/jQuery/jquery-2.1.1.js:4409:9)
at HTMLButtonElement.elemData.handle (http://sxa15/sitecore/shell/client/Speak/Assets/lib/core/1.1/deps/jQuery/jquery-2.1.1.js:4095:28)
</code></pre></div></div>
<p>Please go to the next section and see what you can do to mitigate the issue.</p>
<h2 id="solution">Solution</h2>
<ul>
<li>Download
<a href="/files/posts/errors/upload-media-dialog/UploadMediaDialog-hotfix.zip">
UploadMediaDialog-hotfix.zip for <strong>SXA 1.5</strong>
</a></li>
<li>Install package</li>
</ul>
<p class="notice"><strong>Important:</strong> Package can be installed both on <strong>Sitecore 8.2</strong> and <strong>9.0</strong></p>
<h2 id="details">Details</h2>
<p>This package will install single item in core database.</p>
<ul>
<li>
<p><code class="language-plaintext highlighter-rouge">items\core\sitecore\client\Applications\Dialogs\UploadMediaDialog</code> - overwrite previous version of an item. It adds one missing SPEAK rendering and modifies PageCode value</p>
<ul>
<li>
<p>Additional <code class="language-plaintext highlighter-rouge">Text</code> type rendering with id <code class="language-plaintext highlighter-rouge">SxaSiteMediaLibrary</code></p>
</li>
<li>
<p>Page Code:</p>
</li>
</ul>
</li>
</ul>
<p>from</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Sitecore.Speak.Applications.UploadMediaDialog, Sitecore.Speak.Applications
</code></pre></div></div>
<p>to</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Sitecore.XA.Foundation.Multisite.Speak.Applications.UploadMediaDialog, Sitecore.XA.Foundation.Multisite
</code></pre></div></div>
<h1 id="summary">Summary</h1>
<p>The post will be updated once the fix for the issue will be delivered with the next public release of <strong>SXA</strong>.</p>
<p><a href="https://alan-null.github.io/2017/12/sxa-hotfix-upload-media-dialog">SXA 1.5 hotfix: UploadMediaDialog</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on December 04, 2017.</p>
https://alan-null.github.io/2017/11/beautify-field-names2017-11-30T00:00:00+01:002017-11-30T00:00:00+01:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Find all fields with incorrect title and fix them to stop users eyes from bleeding. <!--more--></p>
<h1 id="introduction">Introduction</h1>
<p>If you create fields without spaces in a name then there is a big chance that you forget about setting its title.</p>
<p>Then users will see something like this:</p>
<p><a href="/images/posts/beautify-field-names/fields.png" class="img-container">
<img src="/images/posts/beautify-field-names/fields.png" />
</a></p>
<p>Not a big deal? Maybe but I am perfectionist and I could not leave it without any action.</p>
<h1 id="powershell-power">Powershell power</h1>
<h2 id="usage">Usage</h2>
<h3 id="get-template-fields-without-valid-title-from-whole-database">Get template fields without valid title from whole database</h3>
<figure class="highlight"><pre><code class="language-powershell" data-lang="powershell"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
</pre></td><td class="code"><pre><span class="n">Get-TemplateFieldWithoutValidTitle</span>
</pre></td></tr></tbody></table></code></pre></figure>
<h3 id="get-template-fields-without-valid-title-from-part-of-a-tree">Get template fields without valid title from part of a tree</h3>
<figure class="highlight"><pre><code class="language-powershell" data-lang="powershell"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
</pre></td><td class="code"><pre><span class="nv">$startItem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Item</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="s1">'/sitecore/templates/System/Media/Versioned'</span><span class="w">
</span><span class="n">Get-TemplateFieldWithoutValidTitle</span><span class="w"> </span><span class="nv">$startItem</span>
</pre></td></tr></tbody></table></code></pre></figure>
<h3 id="get-template-fields-without-valid-title-from-part-of-the-a-and-format-it">Get template fields without valid title from part of the a and format it</h3>
<figure class="highlight"><pre><code class="language-powershell" data-lang="powershell"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
</pre></td><td class="code"><pre><span class="nv">$startItem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Item</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="s1">'/sitecore/templates/System/Media/Versioned'</span><span class="w">
</span><span class="n">Get-TemplateFieldWithoutValidTitle</span><span class="w"> </span><span class="nv">$startItem</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Format-Table</span><span class="w"> </span><span class="nt">-Property</span><span class="w"> </span><span class="nx">ID</span><span class="p">,</span><span class="w"> </span><span class="nx">Name</span><span class="p">,</span><span class="w"> </span><span class="p">@{</span><span class="nx">Expression</span><span class="o">=</span><span class="p">{</span><span class="w"> </span><span class="n">Get-Title</span><span class="w"> </span><span class="bp">$_</span><span class="o">.</span><span class="nf">Name</span><span class="w"> </span><span class="p">};</span><span class="n">Label</span><span class="o">=</span><span class="s2">"Suggested Title"</span><span class="p">},</span><span class="w"> </span><span class="nx">ItemPath</span><span class="w"> </span><span class="err">-</span><span class="nx">AutoSize</span>
</pre></td></tr></tbody></table></code></pre></figure>
<p>Example result</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ID Name Suggested Title ItemPath
-- ---- --------------- --------
{9C6E9C07-FC48-40BA-89CC-A263AAC0C89A} ZipCode Zip Code /sitecore/templates/System/Media/Versioned/File/Location/ZipCode
{5A3DEDAA-C9BC-490B-B2A1-C79E0EA83151} CountryCode Country Code /sitecore/templates/System/Media/Versioned/File/Location/CountryCode
{24DEF54B-DB0D-4BDC-BF33-DE36A37D5186} LocationDescription Location Description /sitecore/templates/System/Media/Versioned/File/Location/LocationDescription
</code></pre></div></div>
<p>After you get results you can process items in a loop and set title to suggested title (item name with additional spaces near upper-case letters)</p>
<h2 id="script-source">Script source</h2>
<p><a href="https://github.com/PowerShellLibrary/Sitecore/blob/master/Cmdlet/Get-TemplateFieldWithoutValidTitle.ps1"><strong>Get-TemplateFieldWithoutValidTitle.ps1</strong></a></p>
<h1 id="summary">Summary</h1>
<p>I use Powershell almost everyday. Many times I had a situation when I knew that I wrote something but it is gone or hidden somewhere.</p>
<p>That’s why I’ve decided to create a repository with all my scripts (<a href="https://github.com/PowerShellLibrary/Sitecore/">SitecorePowerShellLibrary</a>).</p>
<p>Right now, it’s kinda empty, but collection will grow.</p>
<p>If you follow me on twitter <a href="//twitter.com/alanploc">@AlanPloc</a> you are safe, because I am going to link all new scripts there.
In case you are not using twitter to follow people you can follow github project or add my blog to your feed reader.</p>
<p><a href="https://alan-null.github.io/2017/11/beautify-field-names">Beautify Sitecore field names</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on November 30, 2017.</p>
https://alan-null.github.io/2017/09/sitecore-extensions-ff2017-09-25T00:00:00+02:002017-09-25T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Important information for Firefox users about new versions of <strong>Sitecore Extensions</strong> addon. <!--more--></p>
<h1 id="introduction">Introduction</h1>
<p>Long story short,</p>
<p><strong>Mozilla declined any of my further sc-ext updates on Mozzila Addons portal</strong></p>
<p>Here is why:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>To clarify it, is there a way that a regular user can sign up for a Sitecore CMS account? Is there a way to install Sitecore CMS software without requiring payment?
Thanks!
</code></pre></div></div>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Hello,
Your add-on, Sitecore Extensions 3.2.0, has been reviewed and did not meet the criteria for being hosted in our gallery.
Comments:
Thank you for your contribution. We apologize for not informing you before, but that due to the limited/non-public audience of this add-on, this add-on is not suitable for being listed.
</code></pre></div></div>
<p>Currently the latest hosted version is <a href="https://addons.mozilla.org/pl/firefox/addon/sitecore-extensions">Sitecore Extensions 3.1 </a></p>
<p>As long as Mozilla won’t take this down I will keep it there. It’s funny because few weeks before when I transformed an addon from old format into WebExtension it was accepted without any problems.</p>
<p>Well I’ve tried few times with different reviewers but obviously it’s not a single guy who had a bad day but they have changed the rules.</p>
<h1 id="whats-next">What’s next</h1>
<p>Have no fear Alan is here. There is a way to mitigate this issue with self-hosted addon.</p>
<h2 id="installation">Installation</h2>
<ol>
<li>
<p>Download self-hosted package. You will find the most the most recent version here
<a href="https://github.com/alan-null/sc_ext.firefox/raw/master/xpi/sitecore_extensions-3.2.0-an%2Bfx.xpi">sitecore_extensions-3.2.0.xpi</a>.</p>
</li>
<li>
<p>Install. Use menu or simply drag&drop addon into Firefox.</p>
</li>
</ol>
<p><a href="/images/posts/sc-ext-ff/install1.gif" class="img-container">
<img src="/images/posts/sc-ext-ff/install1.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<p><a href="/images/posts/sc-ext-ff/install2.gif" class="img-container">
<img src="/images/posts/sc-ext-ff/install2.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h2 id="updates">Updates</h2>
<p>Updates are automatic. From now you don’t have to worry about anything. If you want to enforce update manually here is how you can achieve that:</p>
<p><a href="/images/posts/sc-ext-ff/update.gif" class="img-container">
<img src="/images/posts/sc-ext-ff/update.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<p>If you are interested where is the repository of all versions, it will be located <a href="https://github.com/alan-null/sc_ext.firefox">here</a></p>
<p>There is a <code class="language-plaintext highlighter-rouge">json</code> file definition which will be read by Firefox to determine whether new version is available.</p>
<h1 id="summary">Summary</h1>
<p>In fact it will be super easy for me to provide updates for you right now, I don’t have to go through painful approval process which had no purpose in my case (as chrome extension was always published and approved few days before FF)</p>
<p>Although it sounds crazy to use addons from different sources you don’t have to worry about anything.</p>
<p>I have nothing to hide, code is open and hosted on github. You can unpack an <code class="language-plaintext highlighter-rouge">xpi</code> file and see that the content and local build output is the same.</p>
<p>If you are paranoid like I am and want to control everything, you can disable automatic updates and review new packages once they arrive.</p>
<p>Make sure you follow me on twitter so you won’t miss any updates.</p>
<p><strong>Useful links:</strong></p>
<ul>
<li><a href="https://chrome.google.com/webstore/detail/sitecore-extensions/aoclhcccfdkjddgpaaajldgljhllhgmd">Google Chrome Store: Sitecore Extensions</a></li>
<li><a href="https://addons.mozilla.org/pl/firefox/addon/sitecore-extensions">Mozilla Addons: Sitecore Extensions 3.1 [obsolete]</a></li>
<li><a href="https://github.com/alan-null/sc_ext.firefox">Mozilla Addons: Sitecore Extensions 3.2+</a></li>
<li><a href="https://github.com/alan-null/sc_ext/issues">Github Issues</a></li>
<li><a href="https://github.com/alan-null/sc_ext/blob/master/.github/CONTRIBUTING.md">How to Contribute to #sc_ext project</a></li>
</ul>
<p><a href="https://alan-null.github.io/2017/09/sitecore-extensions-ff">Sitecore Extensions for Mozilla Firefox (self-hosted)</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on September 25, 2017.</p>
https://alan-null.github.io/2017/07/get-items-fastest-way2017-07-13T00:00:00+02:002017-07-13T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>What is the fastest way of getting items? I present you results of my experiment performed some time ago. <!--more--></p>
<h1 id="introduction">Introduction</h1>
<p>Maybe the title is a little bit misleading because finding the fastest way of getting items was not my goal (you can find an answer for this too).</p>
<p>At early days of <strong>Helix</strong> and <strong>Habitat</strong> I was wondering if recommended approach for getting items with additional filtering is not a step back in terms of speed.</p>
<p>Previously I was using in my opinion the fastest way - queries</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fast:/sitecore/content/</span><span class="o">*</span><span class="p">[</span><span class="err">@@</span><span class="n">templatename</span><span class="o">=</span><span class="s2">"TestItem"</span><span class="p">]</span><span class="w">
</span></code></pre></div></div>
<p>I was scared of:</p>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">item.Children.Where</span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="err">></span><span class="w"> </span><span class="n">TemplateManager.GetTemplate</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="nf">InheritsFrom</span><span class="p">(</span><span class="nx">id</span><span class="p">))</span><span class="w">
</span></code></pre></div></div>
<p>I thought that it cannot be faster, but is what’s the truth?</p>
<h1 id="experiment">Experiment</h1>
<p>I decided to perform test to find our what’s the truth.</p>
<h2 id="test-data">Test Data</h2>
<p>First I had to create some test data:</p>
<figure class="highlight"><pre><code class="language-powershell" data-lang="powershell"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre><span class="nv">$root</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"/sitecore/content"</span><span class="w">
</span><span class="nv">$testTemplate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">New-Item</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="s2">"/sitecore/templates/User Defined"</span><span class="w"> </span><span class="nt">-Name</span><span class="w"> </span><span class="s2">"TestItem"</span><span class="w"> </span><span class="nt">-ItemType</span><span class="w"> </span><span class="s2">"System/Templates/Template"</span><span class="w">
</span><span class="p">[</span><span class="n">Sitecore.Data.Items.TemplateItem</span><span class="p">]</span><span class="nv">$testTemplate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">$testTemplate</span><span class="w">
</span><span class="nv">$performanceRoot</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">New-Item</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="nv">$root</span><span class="w"> </span><span class="nt">-Name</span><span class="w"> </span><span class="s2">"PerformanceRoot"</span><span class="w"> </span><span class="nt">-ItemType</span><span class="w"> </span><span class="nv">$testTemplate</span><span class="o">.</span><span class="nf">FullName</span><span class="w">
</span><span class="mi">0</span><span class="o">..</span><span class="mi">9</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nv">$level0</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">$_</span><span class="w">
</span><span class="nv">$level0Parent</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">New-Item</span><span class="w"> </span><span class="nt">-Parent</span><span class="w"> </span><span class="nv">$performanceRoot</span><span class="w"> </span><span class="nt">-Name</span><span class="w"> </span><span class="nv">$level0</span><span class="w"> </span><span class="nt">-ItemType</span><span class="w"> </span><span class="nv">$testTemplate</span><span class="o">.</span><span class="nf">FullName</span><span class="w">
</span><span class="nx">0..9</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nv">$level1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">$_</span><span class="w">
</span><span class="nv">$level1Parent</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">New-Item</span><span class="w"> </span><span class="nt">-Parent</span><span class="w"> </span><span class="nv">$level0Parent</span><span class="w"> </span><span class="nt">-Name</span><span class="w"> </span><span class="nv">$level1</span><span class="w"> </span><span class="nt">-ItemType</span><span class="w"> </span><span class="nv">$testTemplate</span><span class="o">.</span><span class="nf">FullName</span><span class="w">
</span><span class="nx">0..9</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nv">$level2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">$_</span><span class="w">
</span><span class="n">New-Item</span><span class="w"> </span><span class="nt">-Parent</span><span class="w"> </span><span class="nv">$level1Parent</span><span class="w"> </span><span class="nt">-Name</span><span class="w"> </span><span class="nv">$level2</span><span class="w"> </span><span class="nt">-ItemType</span><span class="w"> </span><span class="nv">$testTemplate</span><span class="o">.</span><span class="nf">FullName</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Out-Null</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<p>In content tree it looked like this:</p>
<p><a href="/images/posts/get-items-fastest-way/content-tree.png" class="img-container">
<img src="/images/posts/get-items-fastest-way/content-tree.png" />
</a></p>
<h2 id="logic">Logic</h2>
<p>After I had my items ready in database I wrote different function for obtaining items. Note that that filtering in some methods is different than recommended by <strong>Helix</strong> (checking template name instead of inheritance).</p>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">GetDescendantsAllItems</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="n">ID</span> <span class="n">id</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="kt">var</span> <span class="n">items</span> <span class="p">=</span> <span class="n">item</span><span class="p">.</span><span class="n">Axes</span><span class="p">.</span><span class="nf">GetDescendants</span><span class="p">()</span>
<span class="p">.</span><span class="nf">Where</span><span class="p">(</span><span class="n">i</span> <span class="p">=></span> <span class="n">TemplateManager</span><span class="p">.</span><span class="nf">GetTemplate</span><span class="p">(</span><span class="n">i</span><span class="p">).</span><span class="nf">InheritsFrom</span><span class="p">(</span><span class="n">id</span><span class="p">))</span>
<span class="p">.</span><span class="nf">ToList</span><span class="p">();</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">AddRange</span><span class="p">(</span><span class="n">items</span><span class="p">);</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">ChildrenRecursive</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="n">ID</span> <span class="n">id</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="kt">var</span> <span class="n">itemChildren</span> <span class="p">=</span> <span class="n">item</span><span class="p">.</span><span class="n">Children</span><span class="p">;</span>
<span class="kt">var</span> <span class="n">items</span> <span class="p">=</span> <span class="n">itemChildren</span>
<span class="p">.</span><span class="nf">Where</span><span class="p">(</span><span class="n">i</span> <span class="p">=></span> <span class="n">TemplateManager</span><span class="p">.</span><span class="nf">GetTemplate</span><span class="p">(</span><span class="n">i</span><span class="p">).</span><span class="nf">InheritsFrom</span><span class="p">(</span><span class="n">id</span><span class="p">))</span>
<span class="p">.</span><span class="nf">ToList</span><span class="p">();</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">AddRange</span><span class="p">(</span><span class="n">items</span><span class="p">);</span>
<span class="k">foreach</span> <span class="p">(</span><span class="n">Item</span> <span class="n">i</span> <span class="k">in</span> <span class="n">itemChildren</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">i</span><span class="p">.</span><span class="n">HasChildren</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">AddRange</span><span class="p">(</span><span class="nf">ChildrenRecursive</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">id</span><span class="p">).</span><span class="n">Items</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">SelectItems</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="kt">string</span> <span class="n">query</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">AddRange</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">Axes</span><span class="p">.</span><span class="nf">SelectItems</span><span class="p">(</span><span class="n">query</span><span class="p">));</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">ChildrenSingleLevel</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="n">ID</span> <span class="n">id</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="kt">var</span> <span class="n">items</span> <span class="p">=</span> <span class="n">item</span><span class="p">.</span><span class="n">Children</span>
<span class="p">.</span><span class="nf">Where</span><span class="p">(</span><span class="n">i</span> <span class="p">=></span> <span class="n">TemplateManager</span><span class="p">.</span><span class="nf">GetTemplate</span><span class="p">(</span><span class="n">i</span><span class="p">).</span><span class="nf">InheritsFrom</span><span class="p">(</span><span class="n">id</span><span class="p">))</span>
<span class="p">.</span><span class="nf">ToList</span><span class="p">();</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">AddRange</span><span class="p">(</span><span class="n">items</span><span class="p">);</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">SelectItem</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="kt">string</span> <span class="n">query</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">Add</span><span class="p">(</span><span class="n">item</span><span class="p">?.</span><span class="n">Axes</span><span class="p">.</span><span class="nf">SelectSingleItem</span><span class="p">(</span><span class="n">query</span><span class="p">));</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">GetDescendantsSingleItem</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="n">ID</span> <span class="n">id</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="kt">var</span> <span class="n">items</span> <span class="p">=</span> <span class="n">item</span><span class="p">.</span><span class="n">Axes</span><span class="p">.</span><span class="nf">GetDescendants</span><span class="p">()</span>
<span class="p">.</span><span class="nf">FirstOrDefault</span><span class="p">(</span><span class="n">i</span> <span class="p">=></span> <span class="n">TemplateManager</span><span class="p">.</span><span class="nf">GetTemplate</span><span class="p">(</span><span class="n">i</span><span class="p">).</span><span class="nf">InheritsFrom</span><span class="p">(</span><span class="n">id</span><span class="p">));</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">Add</span><span class="p">(</span><span class="n">items</span><span class="p">);</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">ChildrenSingleItem</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="n">ID</span> <span class="n">id</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="kt">var</span> <span class="n">items</span> <span class="p">=</span> <span class="n">item</span><span class="p">.</span><span class="n">Children</span>
<span class="p">.</span><span class="nf">FirstOrDefault</span><span class="p">(</span><span class="n">i</span> <span class="p">=></span> <span class="n">TemplateManager</span><span class="p">.</span><span class="nf">GetTemplate</span><span class="p">(</span><span class="n">i</span><span class="p">).</span><span class="nf">InheritsFrom</span><span class="p">(</span><span class="n">id</span><span class="p">));</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">Add</span><span class="p">(</span><span class="n">items</span><span class="p">);</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">SelectItemFast</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="kt">string</span> <span class="n">query</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">Add</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">Database</span><span class="p">.</span><span class="nf">SelectSingleItem</span><span class="p">(</span><span class="n">query</span><span class="p">));</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
</pre></td><td class="code"><pre><span class="k">public</span> <span class="k">static</span> <span class="n">Result</span> <span class="nf">SelectItemsFast</span><span class="p">(</span><span class="n">Item</span> <span class="n">item</span><span class="p">,</span> <span class="kt">string</span> <span class="n">query</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">r</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Result</span><span class="p">();</span>
<span class="n">r</span><span class="p">.</span><span class="n">Items</span><span class="p">.</span><span class="nf">AddRange</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">Database</span><span class="p">.</span><span class="nf">SelectItems</span><span class="p">(</span><span class="n">query</span><span class="p">));</span>
<span class="k">return</span> <span class="n">r</span><span class="p">;</span>
<span class="p">}</span>
</pre></td></tr></tbody></table></code></pre></figure>
<h2 id="tests">Tests</h2>
<p>After everything was setup I performed tests. I used something like this:</p>
<figure class="highlight"><pre><code class="language-powershell" data-lang="powershell"><table class="rouge-table"><tbody><tr><td class="gutter gl"><pre class="lineno">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
</pre></td><td class="code"><pre><span class="nv">$item</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Item</span><span class="w"> </span><span class="o">.</span><span class="w">
</span><span class="nv">$templateItem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Get-Item</span><span class="w"> </span><span class="nt">-Path</span><span class="w"> </span><span class="s2">"/sitecore/templates/User Defined/TestItem"</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">GetDescendants - AllItems"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$GetDescendantsAllItems</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">GetDescendantsAllItems</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="nv">$templateItem</span><span class="o">.</span><span class="nf">ID</span><span class="p">)</span><span class="w">
</span><span class="nv">$GetDescendantsAllItems</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$GetDescendantsAllItems</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Children - Recursive"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$ChildrenRecursive</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">ChildrenRecursive</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="nv">$templateItem</span><span class="o">.</span><span class="nf">ID</span><span class="p">)</span><span class="w">
</span><span class="nv">$ChildrenRecursive</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$ChildrenRecursive</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Select Items - AllItems"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$SelectItemsRecursive</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">SelectItems</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="s2">".//*[@@templatename='TestItem']"</span><span class="p">)</span><span class="w">
</span><span class="nv">$SelectItemsRecursive</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$SelectItemsRecursive</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Select Items Fast - AllItems"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$query</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"fast:</span><span class="si">$(</span><span class="nv">$item</span><span class="o">.</span><span class="nf">Paths</span><span class="o">.</span><span class="nf">path</span><span class="si">)</span><span class="s2">//*[@@templatename='TestItem']"</span><span class="w">
</span><span class="nv">$SelectItemsFast</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">SelectItemsFast</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="nv">$query</span><span class="p">,</span><span class="w"> </span><span class="nv">$count</span><span class="p">)</span><span class="w">
</span><span class="nv">$SelectItemsFast</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$SelectItemsFast</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Children - SingleLevel"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$ChildrenSingleLevel</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">ChildrenSingleLevel</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="nv">$templateItem</span><span class="o">.</span><span class="nf">ID</span><span class="p">)</span><span class="w">
</span><span class="nv">$ChildrenSingleLevel</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$ChildrenSingleLevel</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Select Items - SingleLevel"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$SelectItems</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">SelectItems</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="s2">"./*[@@templatename='TestItem']"</span><span class="p">)</span><span class="w">
</span><span class="nv">$SelectItems</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$SelectItems</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">GetDescendants - SingleItem"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$GetDescendantsSingleItem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">GetDescendantsSingleItem</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="nv">$templateItem</span><span class="o">.</span><span class="nf">ID</span><span class="p">)</span><span class="w">
</span><span class="nv">$GetDescendantsSingleItem</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$GetDescendantsSingleItem</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Children - SingleItem"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$ChildrenSingleItem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">ChildrenSingleItem</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="nv">$templateItem</span><span class="o">.</span><span class="nf">ID</span><span class="p">)</span><span class="w">
</span><span class="nv">$ChildrenSingleItem</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$ChildrenSingleItem</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Single Item - SingleLevel"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$SelectItem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">SelectItem</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="s2">"./*[@@templatename='TestItem']"</span><span class="p">)</span><span class="w">
</span><span class="nv">$SelectItem</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$SelectItem</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Single Item - Recursive"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$SelectItemRecursive</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">SelectItem</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="s2">".//*[@@templatename='TestItem']"</span><span class="p">)</span><span class="w">
</span><span class="nv">$SelectItemRecursive</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$SelectItemRecursive</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Select Item Fast - SingleItem"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$query</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"fast:</span><span class="si">$(</span><span class="nv">$item</span><span class="o">.</span><span class="nf">Paths</span><span class="o">.</span><span class="nf">path</span><span class="si">)</span><span class="s2">/*[@@templatename='TestItem']"</span><span class="w">
</span><span class="nv">$SelectItemFast</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">SelectItemFast</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="nv">$query</span><span class="p">,</span><span class="w"> </span><span class="nv">$count</span><span class="p">)</span><span class="w">
</span><span class="nv">$SelectItemFast</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$SelectItemFast</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span><span class="w">
</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"</span><span class="se">`n</span><span class="s2">Select Item Fast - AllItems"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">
</span><span class="nv">$query</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"fast:</span><span class="si">$(</span><span class="nv">$item</span><span class="o">.</span><span class="nf">Paths</span><span class="o">.</span><span class="nf">path</span><span class="si">)</span><span class="s2">//*[@@templatename='TestItem']"</span><span class="w">
</span><span class="nv">$SelectItemFast</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Tests</span><span class="p">]::</span><span class="n">SelectItemFast</span><span class="p">(</span><span class="nv">$item</span><span class="p">,</span><span class="w"> </span><span class="nv">$query</span><span class="p">,</span><span class="w"> </span><span class="nv">$count</span><span class="p">)</span><span class="w">
</span><span class="nv">$SelectItemFast</span><span class="o">.</span><span class="nf">Items</span><span class="o">.</span><span class="nf">Count</span><span class="w">
</span><span class="nv">$SelectItemFast</span><span class="o">.</span><span class="nf">TimeSpan</span><span class="o">.</span><span class="nf">TotalMilliseconds</span>
</pre></td></tr></tbody></table></code></pre></figure>
<p>If you are going to try it by yourself don’t forget to update the max number of items in a query result set (<code class="language-plaintext highlighter-rouge">Query.MaxItems</code>)</p>
<h2 id="results">Results</h2>
<h3 id="average-time---no-cache">Average time - no cache</h3>
<table class="table">
<thead>
<tr>
<th>Function</th>
<th style="text-align: center">Time [ms]</th>
<th style="text-align: right">Items</th>
</tr>
</thead>
<tbody>
<tr>
<td>GetDescendants - AllItems</td>
<td style="text-align: center">536.63012</td>
<td style="text-align: right">1110</td>
</tr>
<tr>
<td>Children - Recursive</td>
<td style="text-align: center">650.29703</td>
<td style="text-align: right">1110</td>
</tr>
<tr>
<td>Select Items - AllItems</td>
<td style="text-align: center">693.7084</td>
<td style="text-align: right">1110</td>
</tr>
<tr>
<td>Select Items Fast - AllItems</td>
<td style="text-align: center">694.98984</td>
<td style="text-align: right">1110</td>
</tr>
<tr>
<td>Children - SingleLevel</td>
<td style="text-align: center">12.03793</td>
<td style="text-align: right">10</td>
</tr>
<tr>
<td>Select Items - SingleLevel</td>
<td style="text-align: center">21.28989</td>
<td style="text-align: right">10</td>
</tr>
<tr>
<td>GetDescendants - SingleItem</td>
<td style="text-align: center">493.75492</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Children - SingleItem</td>
<td style="text-align: center">14.90564</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Single Item - SingleLevel</td>
<td style="text-align: center">23.95847</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Single Item - Recursive</td>
<td style="text-align: center">25.20063</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Single Item Fast - SingleItem</td>
<td style="text-align: center">26.48343</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Single Item Fast - Recursive</td>
<td style="text-align: center">35.9395</td>
<td style="text-align: right">1</td>
</tr>
</tbody>
</table>
<h3 id="average-time---with-cache">Average time - with cache</h3>
<table class="table">
<thead>
<tr>
<th>Function</th>
<th style="text-align: center">Time [ms]</th>
<th style="text-align: right">Items</th>
</tr>
</thead>
<tbody>
<tr>
<td>GetDescendants - AllItems</td>
<td style="text-align: center">16.84566</td>
<td style="text-align: right">1110</td>
</tr>
<tr>
<td>Children - Recursive</td>
<td style="text-align: center">24.65328</td>
<td style="text-align: right">1110</td>
</tr>
<tr>
<td>Select Items - AllItems</td>
<td style="text-align: center">94.90774</td>
<td style="text-align: right">1110</td>
</tr>
<tr>
<td>Select Items Fast - AllItems</td>
<td style="text-align: center">32.19504</td>
<td style="text-align: right">1110</td>
</tr>
<tr>
<td>Children - SingleLevel</td>
<td style="text-align: center">0.20868</td>
<td style="text-align: right">10</td>
</tr>
<tr>
<td>Select Items - SingleLevel</td>
<td style="text-align: center">0.64663</td>
<td style="text-align: right">10</td>
</tr>
<tr>
<td>GetDescendants - SingleItem</td>
<td style="text-align: center">16.11355</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Children - SingleItem</td>
<td style="text-align: center">0.16458</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Single Item - SingleLevel</td>
<td style="text-align: center">0.26698</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Single Item - Recursive</td>
<td style="text-align: center">0.25829</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Single Item Fast - SingleItem</td>
<td style="text-align: center">11.44318</td>
<td style="text-align: right">1</td>
</tr>
<tr>
<td>Single Item Fast - Recursive</td>
<td style="text-align: center">22.55551</td>
<td style="text-align: right">1</td>
</tr>
</tbody>
</table>
<h1 id="summary">Summary</h1>
<p>My goal was to answer my question not test Sitecore speed. I wanted to know whether using <code class="language-plaintext highlighter-rouge">InheritsFrom</code> instead of putting conditions in query isn’t slower.</p>
<p>It turned out that there is noting to be afraid of. Actually the new method is even faster than the old one.</p>
<p><strong>EDIT 2020:</strong></p>
<p>You can find the whole code <a href="https://gist.github.com/alan-null/9bcc770b9987045ee7e1201be0bfe761">here</a></p>
<p><a href="https://alan-null.github.io/2017/07/get-items-fastest-way">Get items - the fastest way</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on July 13, 2017.</p>
https://alan-null.github.io/2017/06/sitecore-extensions_v3_2_02017-06-26T00:00:00+02:002017-06-26T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>This minor release brings few extra features plus many improvements and bug fixes. <!--more--></p>
<h1 id="new-features">New features</h1>
<h3 id="extra-content-editorshell-commands">Extra Content Editor/Shell commands</h3>
<p>New commands have been added. <a href="https://github.com/alan-null/sc_ext/issues/74">Learn more about new commands</a></p>
<h3 id="scroll-to-active-node">Scroll to active node</h3>
<p>Each time you execute an action which uses Content Editor tree you will be scrolled to the active tree node.</p>
<p><a href="/images/posts/sc-ext-3.2.0/scroll_to_active_node.gif" class="img-container">
<img src="/images/posts/sc-ext-3.2.0/scroll_to_active_node.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="exportimport-extension-settings">Export/Import extension settings</h3>
<p>From now your are able to export and import your extension settings.</p>
<p>You can use this feature to</p>
<ul>
<li>backup your settings</li>
<li>copy settings to a different chrome profile</li>
<li>edit your settings using JSON format</li>
</ul>
<p><a href="/images/posts/sc-ext-3.2.0/import_export.png">
<img src="/images/posts/sc-ext-3.2.0/import_export.png" />
</a></p>
<h3 id="global-recently-used-commands">Global recently used commands</h3>
<p>You are able to define whether your recently used commands in <strong>LauncherModule</strong> should be stored in:</p>
<ul>
<li>local storage - separate storage for each domain</li>
<li>global storage - single storage for all domains (settings stored in extension storage)</li>
</ul>
<p><a href="/images/posts/sc-ext-3.2.0/last_cmds_store.png">
<img src="/images/posts/sc-ext-3.2.0/last_cmds_store.png" />
</a></p>
<h3 id="color-mapping-options-for-databasecolormodule">Color mapping options for DatabaseColorModule</h3>
<p>The <strong>DatabaseColorModule</strong> provided only one colour for web database by default. Right now you can specify your own mapping for as many database as you want with any colour you like.</p>
<p><a href="/images/posts/sc-ext-3.2.0/dbcolor_maping.png">
<img src="/images/posts/sc-ext-3.2.0/dbcolor_maping.png" />
</a></p>
<h3 id="events---change-database-name-colour-when-context-database-has-changed">Events - change database name, colour when context database has changed</h3>
<p>Some actions may trigger events so different modules can hook into and provide event handlers. With this I was able to automatically change database colour and name when you change database in any other module.</p>
<p><a href="/images/posts/sc-ext-3.2.0/event_handlers.gif" class="img-container">
<img src="/images/posts/sc-ext-3.2.0/event_handlers.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="progress-message-added-to-the-field-inspector">Progress message added to the field inspector</h3>
<p>There might appear a long delay before field inspector execute an action if your Sitecore instance just went up.</p>
<p>To improve user experience while using field inspector I’ve decided to add <code class="language-plaintext highlighter-rouge">Loading...</code> message.</p>
<p><a href="/images/posts/sc-ext-3.2.0/field_inspector_progress.gif" class="img-container">
<img src="/images/posts/sc-ext-3.2.0/field_inspector_progress.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="reset-single-field-to-standard-values">Reset single field to standard values</h3>
<p>Feature proposed by: <a href="https://github.com/adamnaj">Adam Najmanowicz</a> (<a href="https://twitter.com/adamnaj">@AdamNaj</a>)</p>
<p><strong>FieldInspectorModule</strong> has been extended with another button which let you reset single field to its standard value.</p>
<p><a href="/images/posts/sc-ext-3.2.0/reset_field.gif" class="img-container">
<img src="/images/posts/sc-ext-3.2.0/reset_field.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h1 id="summary">Summary</h1>
<p>Make sure you won’t miss anything and follow me on twitter <a href="//twitter.com/alanploc">@AlanPloc</a></p>
<p>Got a nice idea for module/command? Create <a href="//github.com/alan-null/sc_ext/issues/new">new ticket</a> on project GitHub page or let me know on <a href="//twitter.com/alanploc">twitter</a>.</p>
<p>Official hashtag for this module is <a href="//twitter.com/search?q=%23sc_ext"><strong>#sc_ext</strong></a></p>
<p><strong>Useful links:</strong></p>
<ul>
<li><a href="https://chrome.google.com/webstore/detail/sitecore-extensions/aoclhcccfdkjddgpaaajldgljhllhgmd">Google Chrome Store: Sitecore Extensions</a></li>
<li><a href="https://addons.mozilla.org/pl/firefox/addon/sitecore-extensions">Mozilla Addons: Sitecore Extensions</a></li>
<li><a href="https://github.com/alan-null/sc_ext/issues">Github Issues</a></li>
<li><a href="https://github.com/alan-null/sc_ext/blob/master/.github/CONTRIBUTING.md">How to Contribute to #sc_ext project</a></li>
<li><a href="https://github.com/alan-null/sc_ext/issues?utf8=%E2%9C%93&q=milestone:3.2%20">Version 3.2 changelog</a></li>
<li><a href="https://github.com/alan-null/sc_ext/releases/tag/v3.2.0">Release notes</a></li>
</ul>
<p><a href="https://alan-null.github.io/2017/06/sitecore-extensions_v3_2_0">Sitecore Extensions version 3.2 released</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on June 26, 2017.</p>
https://alan-null.github.io/2017/05/sxa-multisite-management2017-05-15T00:00:00+02:002017-05-15T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p><strong>SXA</strong> allows you to create sites and tenants really quickly. If you ever created a site with wrong features or simply created it to learn new functionalities, you probably tried to remove it. Doing it manually is time-consuming as sites and tenants contain items in locations other than content as well. <!--more--></p>
<h2 id="description">Description</h2>
<p>When creating a new <strong>SXA</strong> site/tenant, scaffolding will also create corresponding media/templates folders for them.</p>
<blockquote>
<p>If you wish to learn more about tenant/site creation process read <a href="https://doc.sitecore.net/sitecore_experience_accelerator/10/setting_up_and_configuring/configuring/create_a_tenant_and_a_site"><em>Create a tenant and a site</em></a> document page.</p>
</blockquote>
<p>Navigating through the tree and removing all items by hand might be really time-consuming.</p>
<p><strong>Multisite Management</strong> solves a problem of manual removal and helps you to easy and quickly clean up your database.</p>
<h3 id="features">Features</h3>
<p><strong>Multisite Management</strong> feature brings several <strong>SPE</strong> scripts integrated with context menu in <em>Content Editor</em>.</p>
<p>Depending on which item you are currently on you will be able to use one of the following functions:</p>
<ul>
<li>Remove Tenant Folder</li>
<li>Remove Tenant</li>
<li>Remove Site Folder</li>
<li>Remove Site</li>
</ul>
<h3 id="demo">Demo</h3>
<p>See <strong>Multisite Management</strong> scripts in action</p>
<p><a href="/images/posts/sxa-multisite-management/demo.gif" class="img-container">
<img src="/images/posts/sxa-multisite-management/demo.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<p>As you can see not only content but also media library was removed with a single click.</p>
<p>What is great, you can have let’s say tenant folder <em>Test</em> and store there all temporary tenants, sites and then simply remove whole folder.</p>
<h3 id="installation">Installation</h3>
<p>Download Sitecore package from here:
<a href="/files/posts/sxa-multisite-management/MultisiteManagement-1.0.zip">
MultisiteManagement-1.0.zip for <strong>SXA 1.3</strong>
</a></p>
<p>Once you install a package new context menu buttons will appear.</p>
<p><a href="/images/posts/sxa-multisite-management/context-menu-remove-tenant.png">
<img src="/images/posts/sxa-multisite-management/context-menu-remove-tenant.png" />
</a></p>
<blockquote>
<p>Items are not deleted completely. If you remove something by mistake you can revert items from <strong>Recycle Bin</strong>
<code class="language-plaintext highlighter-rouge">http://domain/sitecore/shell/Applications/Archives/Recycle%20Bin.aspx?sc_bw=1</code></p>
</blockquote>
<h1 id="summary">Summary</h1>
<p><strong>Multisite Management</strong> feature is a part of <a href="https://github.com/alan-null/XA.Extensions#xa-extensions"><strong>Sitecore Experience Accelerator Extensions</strong></a> project.</p>
<p>If you spot an issue, please go and report it there.
You might also go there to to check other extensions.</p>
<p>Officially supported version for this initial release is <strong>Sitecore Experience Accelerator 1.3</strong>.</p>
<p>For next releases make sure you download appropriate package as <strong>SXA</strong> might change so plugins will have to be updated as well.</p>
<p>Releases section will be updated soon.</p>
<p><a href="https://alan-null.github.io/2017/05/sxa-multisite-management">SXA Extensions - Multisite Management</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on May 15, 2017.</p>
https://alan-null.github.io/2017/05/sxa-toolbox-searchbox2017-05-08T00:00:00+02:002017-05-08T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Once you start working with <strong>SXA</strong> you might be overwhelmed by the number of available renderings. The toolbox is a great feature which lets you drag and drop renderings on the page though sometimes it might be hard to find what you are looking for. <!--more--></p>
<h2 id="description">Description</h2>
<p><strong>Toolbox Search Box</strong> solves a problem of searching a proper toolbox section which contains rendering that you want to add to the page.</p>
<h3 id="demo">Demo</h3>
<p>See <strong>Toolbox Search Box</strong> in action</p>
<p><a href="/images/posts/sxa-toolbox-searchbox/demo.gif" class="img-container">
<img src="/images/posts/sxa-toolbox-searchbox/demo.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<h3 id="installation">Installation</h3>
<p>Download Sitecore package from here:
<a href="/files/posts/sxa-toolbox-searchbox/ToolboxSearchbox-1.0.zip">
ToolboxSearchbox-1.0.zip for <strong>SXA 1.3</strong>
</a></p>
<p>Once you install a package you can start creating <strong>SXA</strong> sites with <strong>Toolbox Search Box</strong>.</p>
<p><a href="/images/posts/sxa-toolbox-searchbox/new-site-dialog.png">
<img src="/images/posts/sxa-toolbox-searchbox/new-site-dialog.png" />
</a></p>
<h3 id="implementation-details">Implementation details</h3>
<p>It was created using Helix principles.
The module integrates with <strong>SXA</strong> via scaffolding so you can select whether you want to have it installed on your site or not.</p>
<h4 id="media-library">Media Library</h4>
<p>In a media library, you will find <strong>Base Theme</strong> which contains all module assets</p>
<p><a href="/images/posts/sxa-toolbox-searchbox/items-media-library.png">
<img src="/images/posts/sxa-toolbox-searchbox/items-media-library.png" />
</a></p>
<h4 id="settings-scaffolding">Settings (scaffolding)</h4>
<p>Under settings, I’ve created a <strong>SXA</strong> scaffolding definition item for <strong>New-Site</strong> dialog</p>
<p><a href="/images/posts/sxa-toolbox-searchbox/items-settings.png">
<img src="/images/posts/sxa-toolbox-searchbox/items-settings.png" />
</a></p>
<p>I used <strong>Edit Editing Theme</strong> action item to integrate with <strong>SXA</strong>.</p>
<p>You can read more about available action items here:
<a href="https://doc.sitecore.net/sitecore_experience_accelerator/setting_up_and_configuring/setting_up/include_your_custom_feature_in_site_and_tenant_scaffolding">Add modules to Site and Tenant scaffolding</a></p>
<h2 id="existing-sites">Existing sites</h2>
<p>My integration is fairly easy so if you want to enable it for existing sites, follow steps below:</p>
<ol>
<li>Go to you site settings item: <code class="language-plaintext highlighter-rouge">/sitecore/content/tenant/site/Settings</code></li>
<li>Find in media library item linked in field <code class="language-plaintext highlighter-rouge">Editing Theme</code></li>
<li>Add following base theme <code class="language-plaintext highlighter-rouge">/sitecore/media library/Feature/Experience Accelerator Extensions/ToolboxSearchbox/ToolboxSearchbox</code> to your <em>Editing Theme</em>.</li>
</ol>
<h2 id="code">Code</h2>
<p>To generate a code for this feature I used code base of my browser extension: <a href="/tag//sc_ext">Sitecore Extensions</a></p>
<p>You can find feature branch here: <a href="https://github.com/alan-null/sc_ext/tree/feature/toolbox_searchbox">https://github.com/alan-null/sc_ext/tree/feature/toolbox_searchbox</a></p>
<h1 id="summary">Summary</h1>
<p>Currently my plugin works only on <strong>Sitecore Experience Accelerator 1.3</strong></p>
<p><a href="https://alan-null.github.io/2017/05/sxa-toolbox-searchbox">SXA Toolbox - Search Box</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on May 08, 2017.</p>
https://alan-null.github.io/2017/04/sxa-hotfix-lookup-name-lookup-value2017-04-24T00:00:00+02:002017-04-24T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>How to solve the issue with <code class="language-plaintext highlighter-rouge">LookupNameLookupValue</code> field while using <strong>Sitecore Experience Accelerator 1.3</strong> <!--more--></p>
<h2 id="problem-description">Problem description</h2>
<p>If you are using <strong>Sitecore Experience Accelerator 1.3</strong> you will probably notice problems with <code class="language-plaintext highlighter-rouge">LookupNameLookupValue</code> field type. This field type is used in <strong>SXA</strong> to provide side-by-side mapping for various features.</p>
<p>Once you set field value and save the item you will notice that field cannot be rendered anymore.</p>
<p><a href="/images/posts/errors/lookup-name-lookup-value/demo.gif" class="img-container">
<img src="/images/posts/errors/lookup-name-lookup-value/demo.jpg" class="img-grayscale" />
<i class="fa fa-play-circle-o img-play" aria-hidden="true"></i>
</a></p>
<p>Please go to the next section and see what you can do to mitigate the issue.</p>
<h2 id="solution">Solution</h2>
<ul>
<li>Download
<a href="/files/posts/errors/lookup-name-lookup-value/LookupNameLookupValue.zip">
LookupNameLookupValue.zip for <strong>SXA 1.3</strong>
</a></li>
<li>Install package</li>
</ul>
<h2 id="details">Details</h2>
<p>This package will revert <code class="language-plaintext highlighter-rouge">LookupNameLookupValue</code> field type to the <strong>1.2</strong> version.</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">items\core\sitecore\system\Field types\List Types\Lookup Name Lookup Value List</code> - overwrite <code class="language-plaintext highlighter-rouge">Control</code> field value to <code class="language-plaintext highlighter-rouge">content:LookupNameLookupValue12</code></li>
<li><code class="language-plaintext highlighter-rouge">files\bin\Sitecore.Playground.XA.WorkaroundFactory.LookupNameLookupValue.dll</code> - define <code class="language-plaintext highlighter-rouge">LookupNameLookupValue12</code> field type</li>
<li><code class="language-plaintext highlighter-rouge">files\App_Config\Include\zzzz.Sitecore.Playground.XA.WorkaroundFactory.LookupNameLookupValue.config</code> - register field type from DLL.</li>
</ul>
<p><a href="https://github.com/alan-null/Sitecore.Playground/commit/09fb9160afc03d951b8b203482eba54f5cbd8ce2">Code</a></p>
<h1 id="summary">Summary</h1>
<p>The post will be updated once the fix for the issue will be delivered with the next public release of <strong>SXA</strong>.</p>
<p><a href="https://alan-null.github.io/2017/04/sxa-hotfix-lookup-name-lookup-value">SXA 1.3 hotfix: LookupNameLookupValue field type</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on April 24, 2017.</p>
https://alan-null.github.io/2017/04/sxa-extra-upgrade-script2017-04-20T00:00:00+02:002017-04-20T00:00:00+02:00Alan Płócieniakhttps://alan-null.github.ioalan-null@outlook.com
<p>Manual steps for <strong>SXA</strong> (1.2 ➡ 1.3) upgrade converted to a new upgrade script. <!--more--></p>
<h1 id="introduction">Introduction</h1>
<p>Recently I’v described how to upgrade SXA from <strong>1.2</strong> to <strong>1.3</strong> with <a href="/2017/04/sxa-upgrade-tool"><strong>SXA Upgrade Tool</strong></a></p>
<p>If you read <a href="https://dev.sitecore.net/Downloads/Sitecore_Experience_Accelerator/13/Sitecore_Experience_Accelerator_13_Initial_Release.aspx">Sitecore Experience Accelerator Upgrade Guide</a>
you will notice following section <strong>1.4 Manual steps</strong>.</p>
<p>If you haven’t done this yet, I’ve got good news. You don’t have to perform these manual steps, you can simply run an extra upgrade step.</p>
<h1 id="extra-upgrade-step">Extra upgrade step</h1>
<p>The script is very similar to other upgrade scripts. With one exception. I do not provide any package and integration with <strong>Upgrade Tool</strong>. Script has to be executed via <strong>ISE</strong></p>
<p>Here is an example diff of tenant templates before and after running an extra upgrade step.</p>
<p><a href="/images/posts/sxa-extra-upgrade-script/templates_diff.png">
<img src="/images/posts/sxa-extra-upgrade-script/templates_diff.png" />
</a></p>
<p>You can find the script code <a href="https://gist.github.com/alan-null/456b5f2683ecfe2853a040b9ec15721e">here</a></p>
<p>or copy entire content below</p>
<script src="https://gist.github.com/alan-null/456b5f2683ecfe2853a040b9ec15721e.js?file=SXA 1.3 - automated manual upgrade steps.ps1"> </script>
<h1 id="summary">Summary</h1>
<p>I won’t describe what exactly this script does because all details can be found in <a href="https://dev.sitecore.net/Downloads/Sitecore_Experience_Accelerator/13/Sitecore_Experience_Accelerator_13_Initial_Release.aspx">Sitecore Experience Accelerator Upgrade Guide</a>.</p>
<p>Enjoy!</p>
<p><a href="https://alan-null.github.io/2017/04/sxa-extra-upgrade-script">SXA 1.2 upgrade - extra upgrade script</a> was originally published by Alan Płócieniak at <a href="https://alan-null.github.io">Alan NULL - Blog</a> on April 20, 2017.</p>