0

I need to achieve below in one config file but getting some conflict error.

could you please help on this. I want to avoid creating multiple files for this purpose only by setting up dependency.

<include name="Content.xxx" database="master" path="/sitecore/content/xxx">
                    <exclude children="true" />
                </include>
                <include name="Content.xxx.yyy" database="master" path="/sitecore/content/xxx/yyy">
                    <exclude children="true" />
                </include>
                <include name="Content.xxx.Corporate" database="master" path="/sitecore/content/xxx/yyy/Corporate">
                    <exclude children="true" />
                </include>
  • What is the config error? – Chris Auer Dec 1 '18 at 15:04
  • And why are you putting the children of a config into another config? Why not just keep them in one include path? – Chris Auer Dec 1 '18 at 15:05
  • if I need "/sitecore/content/xxx/yyy/Corporate" means I need to have parrent node "/sitecore/content/xxx/yyy". xxx is tenant folder, yyy is tenant name and Corporate is site name. these all 3 nodes(xxx, yyy and Corporate) I need excluding children. – Erwin Paul Dec 1 '18 at 16:49
  • Ahh ok. Thank you. What is the error? – Chris Auer Dec 1 '18 at 16:51
  • 2
    Can you please try breaking each up into its own configuration. gist.github.com/dnstommy/a6a1c0a56685da668e62c57befdb7e6e – Chris Auer Dec 1 '18 at 17:19
2

You can't do that in a single file. Once you exclude children of root item you cannot, later on, include it back.

You separate files for this, e.g.:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <unicorn>
            <configurations>
                <configuration name="Content.xxx.yyy" description="Content.xxx.yyy" dependencies="...">
                    <targetDataStore physicalRootPath="..." type="Rainbow.Storage.SerializationFileSystemDataStore, Rainbow" useDataCache="false" singleInstance="true" />
                    <predicate type="Unicorn.Predicates.SerializationPresetPredicate, Unicorn" singleInstance="true">
                        <include name="YYY" database="master" path="/sitecore/content/xxx/yyy" />
                    </predicate>
                </configuration>
            </configurations>
        </unicorn>
    </sitecore>
</configuration>

and the second one:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <unicorn>
            <configurations>
                <configuration name="Content.xxx.Corporate" description="Content.xxx.Corporate" dependencies="...">
                    <targetDataStore physicalRootPath="..." type="Rainbow.Storage.SerializationFileSystemDataStore, Rainbow" useDataCache="false" singleInstance="true" />
                    <predicate type="Unicorn.Predicates.SerializationPresetPredicate, Unicorn" singleInstance="true">
                        <include name="Corporate" database="master" path="/sitecore/content/xxx/yyy/Corporate" />
                    </predicate>
                </configuration>
            </configurations>
        </unicorn>
    </sitecore>
</configuration>

Remember about setting up proper dependencies, so that you won't end up de-serializing child items when root item isn't there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.