Fix HTML tags in Single-line or Multi-line text fields

Between Sitecore 6.5 and Sitecore 6.6 Sitecore changed the way that Text Fields are rendered.They changed it so that text fields output was HTML Encoded. This is technically correct, and it’d be fair to call this a bug fix. It’s much safer to prevent users injecting HTML.

However, this is a problem for systems where users have put HTML content into those text fields, especially where you have thousands and thousands of pages.

For example, in a widget:
Example in a Sublayout

Or in a footer:
Example in Footer

Identifying where those fields contain such values could be … challenging. Instead, Martin English has written a nice processor for the RenderFields pipeline that should restore the old unencoded HTML output.

Fix HTML tags in Single-line or Multi-line text fields

Sitecore’s SearchHits.Slice(int) method seems to change in Sitecore 6.6

I am working on a Sitecore 6.6 upgrade (yes, I know that that is still pretty much obsolete) and I came across a weird bug that took an age to track down. This is more a reminder for myself than anything else.

The code for Lucene searches frequently used lines of the form:

Slice Capture

List<SearchHit> distinctHits = hits.Slice(0).Distinct(new SearchHitEqualityComparer()).ToList();

This always returned zero SearchHits. It seems that this is due to the call to ‘Slice(0)‘ bit. This does raise some questions… Continue reading “Sitecore’s SearchHits.Slice(int) method seems to change in Sitecore 6.6” →

Sitecore’s SearchHits.Slice(int) method seems to change in Sitecore 6.6

Enable SSL for sending emails on Sitecore

I was asked to use a GMail server to send emails from Sitecore with. This is actually a pretty reasonable request – but GMail only supports connections over TLS or SSL. Configuring Web Forms for Marketers to use this was proving … interesting, until I found this excellent article by Mark Cassidy.  Continue reading “Enable SSL for sending emails on Sitecore” →

Enable SSL for sending emails on Sitecore

Awkward SharePoint Link field text

I had a gnarly support call today. One of our customers was using Announcement lists to display news on the homepage of their intranet, and they’ve a thumbnail image they’d set for each item. Then, on the home page, they’ve got a Content Query Web Part using some custom XSL to render those announcements.

However, the Content Query Web Part would only show some of the thumbnail images.Capture

TL;DR – Saving an image field on a ‘New’ form without a descripion saves a different format to after an ‘Edit’, which sets a default even if you don’t change the image field value.

Continue reading “Awkward SharePoint Link field text” →

Awkward SharePoint Link field text

Make Sitecore record the class writing to the logs

I’m a big fan of writing into your logs the class and method that is currently executing – it makes fault finding so much easier. Typically I’d do this with reflection – but it turns out that you can do this with a small change to Sitecore’s configuration.  Continue reading “Make Sitecore record the class writing to the logs” →

Make Sitecore record the class writing to the logs

Appending to the _content field in Sitecore Search 7.2 and 7.5

The _content field in Lucene for Sitecore is basically the full text index. If you index things like PDFs, Word documents, etc., then the results of the IFilter get stored in the _content field.

You can add computed fields into the _content field simply by specifying them with the name ‘_content’. However, I found some differences with how patch files behave.  Continue reading “Appending to the _content field in Sitecore Search 7.2 and 7.5” →

Appending to the _content field in Sitecore Search 7.2 and 7.5