Skip to content

Instantly share code, notes, and snippets.

@lowedown
lowedown / DatabaseSpeedTest.aspx
Last active March 13, 2017 15:12
Sitecore database speed test
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Diagnostics" %>
<%@ Import Namespace="Sitecore.Data" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
@lowedown
lowedown / AddItemLinkReferencesWithSharedContent.config
Last active June 30, 2016 14:42
Will add child items of related items to publishing queue if they are contained in a specified "shared content" location
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<getItemReferences>
<!-- Returns children of linked references if they are contained in a location specified in the SharedContentLocations setting -->
<processor type="MyProject.AddItemLinkReferencesWithSharedContent, MyProject"/>
</getItemReferences>
@lowedown
lowedown / Fix_WebApi_Issue.config
Last active June 16, 2016 19:38
Patch config to work around non functioning WebApi routes after upgrade to Sitecore 8.1 Update 3
<?xml version="1.0" encoding="utf-8" ?>
<!-- Fixes issue preventing all Web Api routes from working -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<experienceAnalytics>
<api>
<logger type="Sitecore.ExperienceAnalytics.Core.Diagnostics.Logger, Sitecore.ExperienceAnalytics"/>
</api>
</experienceAnalytics>
</sitecore>
@lowedown
lowedown / ProxyTest.aspx
Created April 13, 2016 16:13
Sitecore Admin Page to test accessing URLs
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Threading.Tasks" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Test Proxy Settings</title>
@lowedown
lowedown / MultiSiteRichTextEditorProfile.config
Last active March 4, 2016 17:04
Custom Editor Configuration allowing you to set RichText Editor Profiles per Site instead of using the global "HtmlEditor.DefaultProfile" setting.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<!-- Set custom RichText Configuration Type to allow multi site configuration -->
<setting name="HtmlEditor.DefaultConfigurationType" value="MyProject.MultiSiteRichTextConfiguration,MyProject"/>
<setting name="MultiSiteRichTextConfiguration.DefaultDatabase" value="master"/>
<setting name="MultiSiteRichTextConfiguration.CoreDatabase" value="core"/>
@lowedown
lowedown / gist:7cc68e593d184ed41e71
Created October 30, 2015 15:24
Minimal Sitecore Index configuration with language
<myLanguageSearchConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<indexAllFields>false</indexAllFields>
<initializeOnAdd>true</initializeOnAdd>
<analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer" />
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<!-- Needed for updating documents in the index -->
<field fieldName="_uniqueid" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
@lowedown
lowedown / Minimal FieldMap
Created August 9, 2014 22:04
Minimal FieldMap Configuration
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<!-- Add custom fields here -->
<field fieldName="MyCustomField" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="4f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
<!-- System fields to allow correct mapping -->
<field fieldName="_uniqueid" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
@lowedown
lowedown / AssociateCampaignToVisit.cs
Created July 11, 2014 07:25
Hook for the triggerCampaign pipeline to always associate a campaign to a visit.
public class AssociateCampaignToVisit : TriggerCampaignProcessor
{
public override void Process(TriggerCampaignArgs args)
{
Assert.ArgumentNotNull((object)args, "args");
// Always associate the campaign to the current visit when triggered
Sitecore.Analytics.Tracker.CurrentVisit.CampaignId = args.Definition.ID.ToGuid();
}
}
@lowedown
lowedown / AuthenticatedPublishAgent.cs
Last active August 29, 2015 14:03
Extension of a Sitecore PublishAgent to run publish jobs under a specific user
public class AuthenticatedPublishAgent : PublishAgent
{
private readonly string _userName;
public string UserName
{
get
{
return this._userName;
}
@lowedown
lowedown / ViewJobs.aspx
Last active April 11, 2016 20:38
Sitecore Admin Page to show currently running Jobs
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="Sitecore.Jobs" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Running Sitecore Background Jobs</title>
<meta http-equiv="refresh" content="3" />