Reputation: 85
I am using Unicorn for item serialization to my local file system. In this configuration I have a collection which contains a lot of items. These items don't have to be serialized to my file system, but the root folder should.
So I included the root folder, but how can I configure Unicorn to skip its child items?
<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>
Upvotes: 6
Views: 3824
Reputation: 997
In 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 answer with trailing slash works too but this is the preferred way since 3.1 according to kamsar's blog post.
Upvotes: 1
Reputation: 310
If you are using Unicorn 3, it is now possible to skip child items 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 information.
Upvotes: 6
Reputation: 360
It's not possible the way you're proposing, although it doesn't seems so hard looking at the code to implement it that way. But it might be useful to exclude the unnecessary items by template. This can be achieve by adding the following exclude tags inside the include tag.
<exclude template="Page" />
<exclude templateid="{8EF706F3-71D1-4EE2-BADF-99018AF186C9}" />
Upvotes: 4