Instantly share code, notes, and snippets.

View zwavegraph2.html
<dom-module id='ha-panel-zwavegraph2'>
<template>
<style include="ha-style">
.node > rect
{
stroke: black;
}
.node.layer-1 > rect, .edgePath.layer-1 > path
{
View Get-TaggedItems.ps1
gci -path 'master:\content\Habitat sites\Habitat Legal\Home\News' |
%{ [PSCustomObject]@{ Name=&{$_.Title};
Author=&{@( $_.PSFields.Author.Items |
%{ gi master: -id $_ } |
%{ "$($_._Name) ($($_.JobTitle))" }) -join ", "};
Tags=&{@( $_.PSFields.SxaTags.Items |
%{ gi master: -id $_ } |
%{ $_.Name }) -join ", "}
} } | ft -prop @{name="Name"; width=50; Expression={$_.Name}},
@{name="Author"; width=60; Expression={$_.Author}}, Tags
View Import.ps1
$xmlPath = "$AppPath\sugcon.xml"
$pageTemplate = "Project/Community/Page"
$siteHome = "master:\content\Community\SUGCON\Home"
$sitepath = "master:\content\Community\SUGCON"
[string[]]$content = get-content $xmlPath
[xml]$xml = $content
$pages = $xml.rss.channel.item | %{ [PSCustomObject]@{
View Clone Site.ps1
# Open the following item:
# /sitecore/system/Modules/PowerShell/Script Library/SXA/SXA - Multisite/Content Editor/Context Menu/Clone Site
# inside the try{ } clause wrap its content with:
New-UsingBlock(New-Object -TypeName "Sitecore.SecurityModel.SecurityDisabler"){
# all code that was inside the try clause before - goes here
}
View Add-ProjectSpecificComponentDatasource.ps1
###### user settings start here
# Path to the tenant that you want to update
$tenantTemplatesPath = "master:\templates\Project\Showcase"
# Site that should be upgraded to the new template - ise asterisk to upgrade multiple sites.
$sitePath = "master:\content\Showcase\*"
# Path to the component for which you want to introduce your own data source
$componentPath = 'master:\layout\Renderings\Feature\Experience Accelerator\Page Content\Promo'
View Convert-EventsToSearchable.ps1
$tenantTemplatesPath = "master:\templates\Project\Showcase"
$sitePath = "master:\content\Showcase\int"
function Assert-FeatureTemplateInProject {
[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[String[]] $TenantTemplateFolder,
[parameter(Mandatory=$true)]
View Add-TagToPages.ps1
$sitePath = "master:\content\Demo\Origin"
#get items but only those that are SXA pages
$pages = Get-ChildItem "$sitePath\Home" -Recurse -WithParent |
Where-Object { Test-BaseTemplate -Item $_ -Template "Foundation/Experience Accelerator/Multisite/Content/Page" }
#you can pipe it to further filtering here if you want to do it only for some pages
#get tag items that contain the word "Adam" in them
$tags = (@() + (Get-ChildItem "$sitePath\Data\Tags" -Recurse |
Where-Object { Test-BaseTemplate -Item $_ -Template "Feature/Experience Accelerator/Taxonomy/Datasource/Tag" } |
View Set-Layout.ps1
# branch that should be replaced - change the path
$items = Get-ChildItem master:\content\home2 -WithParent
# layout I want to set on my items
$layout = Get-Item 'master:\layout\Layouts\Foundation\Experience Accelerator\MVC\MVC Layout'
# Device on which I want to set it
$device = Get-LayoutDevice "Mobile"
foreach($item in $items){
View CopyOrMove-Renderings.ps1
#branch that should be replaced - change the path
$items = Get-ChildItem master:\content\home2 -WithParent
#Provide the names for your devices from which and to which things should be copied
$fromDevice = Get-LayoutDevice "Default"
$toDevice = Get-LayoutDevice "Mobile"
# for Final layout renderings you need to add -FinalLayout switch to the Add/Remove-Rendering cmdlets
# and provide the -Language for which you want to perform the operation
View Test-RenderingUsage.ps1
Get-Item 'master:\layout\Renderings\Feature\Experience Accelerator\Media\Video' | Get-ItemReferrer | Show-ListView