Sitecore Unicorn item synchronization

I use Unicorn to serialize items on the local file system. In this configuration, I have a collection containing many elements. These items do not have to be serialized for my file system, but the root folder should.

So, I have included the root folder, but how to configure Unicorn to skip its children?

<include database="master" path="/sitecore/content/mycollection" /> 

I would expect something like

 <include database="master" path="/sitecore/content/mycollection" excludeChilds="true /> 

or

 <include database="master" path="/sitecore/content/mycollection"><exclude "*" /></include> 
+5
source share
3 answers

It’s impossible, as you suggest, although it doesn’t seem so difficult to look at the code to implement it this way. But it may be useful to exclude unnecessary elements from the pattern. This can be achieved by adding the following exception tags inside the include tag.

 <exclude template="Page" /> <exclude templateid="{8EF706F3-71D1-4EE2-BADF-99018AF186C9}" /> 
+4
source

If you are using Unicorn 3, you can now skip child elements by adding a trailing slash.

 <include database="master" path="/sitecore/content"> <exclude path="/sitecore/content/" /> </include> 

See http://kamsar.net/index.php/category/Unicorn/#Exclude_all_children_with_the_predicate for more details.

+5
source

In the unicorn 3.1

 <include database="master" path="/sitecore/content/mycollection"> <exclude children="true" /> </include> 

Source: https://kamsar.net/index.php/2016/01/Unicorn-3-1-Released/

Note: elkaz's answer also works with trailing slashes, but this is the preferred way with 3.1 according to the blog post in the block.

0
source

Source: https://habr.com/ru/post/1204261/


All Articles