Skip to content

Instantly share code, notes, and snippets.

View navancommits's full-sized avatar

NAVANEETHAKRISHNAN SUNDARRAJAN navancommits

View GitHub Profile
@navancommits
navancommits / BannerController.cs
Created August 9, 2023 06:39
Banner Rendering
using Sitecore.XA.Feature.Media.Repositories;
using Sitecore.XA.Foundation.Mvc.Controllers;
using System.Web.Mvc;
namespace CustomSXA.Feature.CustomRenderings.Controllers
{
public class BannerController : StandardController
{
protected IImageRepository BannerRepository { get; }
#Originally written to clear item footprint from different folders like, SXA clone rendering script.
#Generic script, could be case-sensitive, you might want to get rid of Contains check
$path="/sitecore"
$match='Copy of Carousel'
$items = Get-ChildItem -Path $path -Recurse
foreach($item in $items) {
if ($item.Name.Equals($match) -or $item.Name.Contains($match)) {
#Write-Host("Removing " + $item.FullPath)
@navancommits
navancommits / RenameAllItems.ps1
Created August 19, 2023 14:57
A sample script to rename items falling in a specific Sitecore tree path, beware that this doesn't change the display name
#reference: https://sitecore.stackexchange.com/questions/33414/rename-items-with-specific-name-in-my-sitecore-content-tree-using-powershell-scr
$path="/sitecore"
$find='FeatureBlock'
$replace='CarouselSlider'
$items = Get-ChildItem -Path $path -Recurse
foreach($item in $items) {
if ($item.Name.Equals($find) -or $item.Name.Contains($find)) {