Patch delete Sitecore elements based on element content

Recently, I wrote about patching Sitecore instances for specific roles. During my research on how to do this, I was able to use a manner of Sitecore patching I had not previously known about. With a patch:instead, instead of targeting an attribute of the element you can actually target the contents of that element. (Thanks to @jammykam for that Stack Overflow post!)

Why is this useful?

Typically patch:instead is used to replace one value with another in the settings, but because of the matching capabilities of this syntax you can use this to patch:delete elements you couldn’t otherwise match against.

So, when you need to remove an element from the configurations that have multiple elements with no distinguishing characteristics, you can target the inner content instead to distinguish them.

Yummy Config example!

Below is a sample config file which can remove a <using> tag by targeting the text inside the using tag.

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
  <sitecore>
    <ui>
      <usings>
        <!--Target based on text in the tag-->
        <using patch:instead="using[.='Sitecore.Social.Client.Wizards.AddNetworkAccount']">
          <patch:delete />
        </using>
      </usings>
    </ui>
  </sitecore>
</configuration>

Sitecore DevOps: Deploying instance role configurations with solution

Those of you who have installed Sitecore in a scaled environment (i.e. multiple instances) know that the process can be somewhat tedious. To configure an instance to use a specific role, you need to manually enable/disable/modify config files to make the instance act as a delivery, authoring, or processing instance. Oh, do you also want to upgrade to the latest update? Be prepared to have to do it all over again.

While we wait for Sitecore to make this process a little bit easier, I decided that enough was enough and I wasn’t doing those steps anymore. Introducing the Sitecore Role Configs!

https://github.com/jst-cyr/Sitecore-Role-Configs

Inspired by the work in @kamsar’s SwitchMasterToWeb, the role configs capture the manual steps from those guides in a single role-specific file. Need to configure a processing instance? Drop the processing config file for your version of Sitecore.

Note: Hardening is not covered in these files, so keep that SwitchMasterToWeb handy!

At the time of writing, I’ve got Sitecore 8.0 Update 3 to Update 7 supported and will be working to get other versions in there as time goes by.

One day, I hope that the need for these files will be completely obsolete and I will laugh at how easy it is to deploy new roles of Sitecore. For now, though, happy deployments, and let me know if you find any issues and I’ll fix them up!

Sixth day of Christmas… Keystone config tips!

On the sixth day of Christmas, my true blog gave to me:

Six Keystone config tips,
Five Golden Rules!
Four CI tools
,
Three powershell scripts,
Two Keystone merge tips,
…and a placeholder rule in the content tree.

There are a lot of configurations that come with the Keystone for Sitecore development accelerator, but here are six that you may not know about!
Continue reading “Sixth day of Christmas… Keystone config tips!”

Sitecore 7: Ensuring IQueryable ordering with string fields

Sitecore 122I hadn’t had the chance to really play around with the indexing options in Sitecore 7 until this past week when I needed to build a listing page from an index and sort it by the page title. At first, I just couldn’t get it to work. The ordering never seemed to match up to the actual title field I was ordering by. Time to dig into the indexing configurations!

Continue reading “Sitecore 7: Ensuring IQueryable ordering with string fields”

Source-controlling Sitecore: TDS Project Configuration Basics

HedgehogYour Sitecore content changes are just as important as the code you are writing for your solution, and that means you should be tracking those changes in source control.   Your team will be making a lot of changes to fields, templates, presentation details, and various other elements for which you will want version history.  This is where Team Development for Sitecore (TDS) comes in.

Team Development for Sitecore

Our teams use Team Development for Sitecore from Hedgehog Development to create .NET TDS projects to source control the changes we make in the Sitecore database.  There’s a great guide that Hedgehog posted online on how to get started with TDS projects in .NET, but here are the basics of how you get set up:

Continue reading “Source-controlling Sitecore: TDS Project Configuration Basics”