This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ----------------------------------------------------------- | |
| # Inline Script for Sitecore PowerShell ISE: | |
| # Replace Multiple Placeholders for Renderings | |
| # Target Item: Default is /sitecore/content/Zont/Habitat/Home/AAA | |
| # DB: master | |
| # - Processes Standard Values, Shared Layout, and Final Layout. | |
| # - Replaces three placeholder pairs: | |
| # $OldPlaceholder1 → $NewPlaceholder1 | |
| # $OldPlaceholder2 → $NewPlaceholder2 | |
| # $OldPlaceholder3 → $NewPlaceholder3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [string]$PageItemPath = "/sitecore/content/Zont/Habitat/Home/AAA", | |
| [string]$LayoutItemPath = "/sitecore/layout/Layouts/Foundation/JSS Experience Accelerator/Presentation/JSS Layout" | |
| ) | |
| # 1. Mount "master:" drive if missing | |
| if (-not (Get-PSDrive -Name master -ErrorAction SilentlyContinue)) { | |
| try { | |
| New-PSDrive -Name master -PSProvider Sitecore -Root "/" -Database "master" -ErrorAction Stop | Out-Null | |
| Write-Host "📁 Mounted master: drive." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Batch Create / Update Rendering Definitions for Zont Feature | |
| # ------------------------------------------------------------ | |
| # ❶ Mount master: drive if absent | |
| if (-not (Get-PSDrive -Name master -ErrorAction SilentlyContinue)) { | |
| New-PSDrive -Name master -PSProvider Sitecore -Root "/" -Database "master" -ErrorAction Stop | Out-Null | |
| } | |
| # ❷ Grab master DB and base item | |
| $db = [Sitecore.Configuration.Factory]::GetDatabase("master") | |
| $basePath = "/sitecore/layout/Renderings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # It will show all the media sorted by the size, descending, from the largest to the smallest | |
| # 1) Mount master: PSDrive if it’s not present | |
| if (-not (Get-PSDrive -Name master -ErrorAction SilentlyContinue)) { | |
| New-PSDrive -Name master -PSProvider Sitecore -Root "\" -Database master | Out-Null | |
| } | |
| # 2) Cache the master database object | |
| $database = [Sitecore.Configuration.Factory]::GetDatabase("master") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Creates rendering definition item under a specified ID, in this case it is: {781C6B36-4B02-46EA-8ADC-B92A11877F10} | |
| # 1. Define the full path for the rendering | |
| $FullPath = "/sitecore/layout/Renderings/Feature/Zont/Teasers/Content Teaser with Summary" | |
| # 2. Mount the master: PSDrive if it’s not already mounted | |
| if (-not (Get-PSDrive -Name master -ErrorAction SilentlyContinue)) { | |
| New-PSDrive -Name master -PSProvider Sitecore -Root "/" -Database "master" -ErrorAction Stop | Out-Null | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- We attach two legacy databases into a locally-run XM Cloud instance: "CoreOld" and "Old" (which is master) | |
| EXEC sys.sp_configure N'contained database authentication', N'1' | |
| go | |
| exec ('RECONFIGURE WITH OVERRIDE') | |
| go | |
| CREATE DATABASE [Sitecore.Old] | |
| ON (FILENAME = 'C:\data\Sitecore.Old_Primary.mdf'), | |
| (FILENAME = 'C:\data\Sitecore.Old_Primary.ldf') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Moves page items in bulk preserving the IDs (here's one level up, but could be anything, but did not work between databases): | |
| param( | |
| [string]$SourceDatabase = "master", | |
| [string]$SourcePath = "sitecore/content/Zont/Habitat/Home/Home", | |
| [string]$DestinationDatabase = "master", | |
| [string]$DestinationPath = "sitecore/content/Zont/Habitat/Home" | |
| ) | |
| # 1. Ensure both PS drives exist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
| <sitecore> | |
| <pipelines> | |
| <httpRequestBegin> | |
| <!-- | |
| We replace the existing RequireAuthentication processor (to preserve all its attributes) | |
| and add our IgnoreRules list underneath. | |
| --> | |
| <processor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- PAY ATTENTION TO THE BELOW LINE !!! | |
| use [Sitecore.Old] | |
| GO | |
| -------------------------------------------------------------------------------- | |
| -- 0) Identify layout‐field IDs | |
| -------------------------------------------------------------------------------- | |
| DECLARE | |
| @SharedLayoutFieldId UNIQUEIDENTIFIER, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%@ Page language="c#" %> | |
| <%@ Import Namespace="Microsoft.Extensions.DependencyInjection" %> | |
| <%@ Import Namespace="Sitecore.Abstractions" %> | |
| <%@ Import Namespace="Sitecore.Configuration" %> | |
| <%@ Import Namespace="Sitecore.Data" %> | |
| <%@ Import Namespace="Sitecore.Data.Items" %> | |
| <%@ Import Namespace="Sitecore.DependencyInjection" %> | |
| <%@ Import Namespace="Sitecore.Events" %> | |
| <%@ Import Namespace="Sitecore.Globalization" %> | |
| <%@ Import Namespace="Sitecore.Pipelines" %> |