Skip to content

Instantly share code, notes, and snippets.

View nehemiahj's full-sized avatar

Nehemiah Jeyakumar nehemiahj

View GitHub Profile
@nehemiahj
nehemiahj / listTemplateFieldsList.sql
Last active April 20, 2022 20:43
Get the list of Template Fields which are corrupt (Shared, Unversioned)
SELECT DISTINCT fieldid
FROM versionedfields
WHERE fieldid IN (SELECT [itemid]
FROM sharedfields s
WHERE s.fieldid = '{BE351A73-FCB0-4213-93FA-C302D8AB4F51}'
AND s.value = '1'
UNION
SELECT [itemid]
FROM sharedfields s
WHERE s.fieldid = '{39847666-389D-409B-95BD-F2016F11EED5}'
@nehemiahj
nehemiahj / cleanupSharedAndUnversionedFields.ps1
Last active April 20, 2022 20:45
Clean up corrupted Shared, Unversioned template fields
$dataFolder = [Sitecore.Configuration.Settings]::DataFolder
$tempFolder = $dataFolder + "\temp\upload"
$filePath = Receive-File -Path $tempFolder -overwrite
if($filePath -eq "cancel"){
exit
}
$importList = Import-Csv $filePath
A SPE module that provides a dialog to stage (publish) Sitecore Commerce 8.2.1 catalog data
@nehemiahj
nehemiahj / AddReferrerToTelemetry.cs
Last active July 13, 2022 14:00
Inject Referrer URL to Azure App Insights for Sitecore Instance
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
using Sitecore.Pipelines.HttpRequest;
using System.Web;
namespace Sitecore.Foundation.SitecoreExtensions.Pipelines.HttpRequestBegin
{
public class AddReferrerToTelemetry : HttpRequestProcessor
{
@nehemiahj
nehemiahj / sitecore.xml
Last active July 14, 2022 00:51
StopContentTest
<!-- CAN CANCEL TEST
Determine if a test can be cancelled
-->
<canCancelTest patch:source="Sitecore.ContentTesting.config">
<processor type="Sitecore.ContentTesting.Pipelines.CanControlTest.IsAdmin, Sitecore.ContentTesting"/>
<processor type="Sitecore.ContentTesting.Pipelines.CanControlTest.IsTestOwner, Sitecore.ContentTesting"/>
<processor type="Sitecore.ContentTesting.Pipelines.CanControlTest.HasRole, Sitecore.ContentTesting">
<roles hint="list:AddRole">
<role>sitecore\Analytics Advanced Testing</role>
</roles>
@nehemiahj
nehemiahj / moveSitecoreItemsInBulk.ps1
Last active August 22, 2022 02:58
Sitecore PowerShell Move Items in Bulk
<#
.SYNOPSIS
Move Bulk of Selected Items to Desitnation Folder
.NOTES
NEHEMIAH JEYAKUMAR
#>
$dropDownSelector = Get-Item -Path "master:\sitecore"
@nehemiahj
nehemiahj / Helpers.cs
Last active August 25, 2022 02:24
Read custom header to generate webp format
public virtual string GetSupportedFormats(HttpContextBase context)
{
var acceptTypes = context?.Request?.AcceptTypes ?? new string[] { };
if (acceptTypes.Any())
{
return PipelineHelpers.RunDianogaGetSupportedFormatsPipeline(acceptTypes);
}
var customAccept = context?.Request?.Headers?["customAccept"];
if (!string.IsNullOrEmpty(customAccept))
@nehemiahj
nehemiahj / outbound rule.xml
Created August 25, 2022 20:31
Cache Control Header for 301 Redirects
<outboundRules>
<rule name="Require clients to revalidationpermanent redirects">
<match serverVariable="RESPONSE_Cache_Control" pattern=".*" />
<conditions>
<add input="{RESPONSE_STATUS}" pattern="301" />
</conditions>
<action type="Rewrite" value="public, must-revalidate, max-age=0"/>
</rule>
</outboundRules>
@nehemiahj
nehemiahj / rewrite rule.xml
Created August 25, 2022 20:41
IIS Rewrite Rule
<rule name="Rule for Redirects">
<match url=".*" />
<conditions>
<add input="{Redirects:{PATH_INFO}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="redirect.aspx?url={C:1}" />
</rule>
@nehemiahj
nehemiahj / redirect.aspx
Last active August 31, 2022 12:58
Intermediate Redirect Page
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>redirecting...</title>
</head>
<body>
</body>
</html>