I have 2 templates:
- Template A: PersonalTemplate
- Template B: PrivateTemplate
Here I want to inherit Template B in Template A using the PowerShell script.
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communitySitecore PowerShell has a function called Add-BaseTemplate
. This function can add one or more base templates to a template item.
There are multiple ways to call it, but the simplest is to get both template items and then pass those to the function:
Add-BaseTemplate -Item <Item> -TemplateItem <TemplateItem[]>
You can use that to add Template B
to the base templates for Template A
like this:
$templateB = Get-Item master:\templates\path\to\TemplateB
$templateA = Get-Item master:\templates\path\to\TemplateA
Add-BaseTemplate -Item $templateA -TemplateItem $templateB
__Base template
). Is that what you're hoping to do? If so, you should be able to find what you need here: doc.sitecorepowershell.com/…