Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Page printed from: https://blog.jermdavis.dev/tags/c/5

Posts tagged C# (Page 5)

Three simple patterns for finding a target page

Quite often when you're putting together a website, you find yourself needing to link the current page to some sort of shared page for an action. "Click here to read terms and conditions" is a common example – where all your products need to be able to link to the Ts & Cs page.

A naive implementation might just hard code the path here, but that is inherently fragile. Renaming or moving the page can easily break your code. So what better approaches might you consider for meeting your requirement while allowing editors flexibility? Having talked about these patterns with colleagues a few times recently, I thought I'd write down some of the basics as a reference for future conversations.

Merging package definitons

Continuing on from previous discussions about packages and their definitions, I found myself needing to quickly merge together the definitions of two different packages recently. And that sounded like an opportunity for a simple tool to add to my collection.

A quick “find that item” hack

The other day I was having a conversation with a colleague who was bemoaning the lack of a fast way to paste a Sitecore item path into the UI and have the Content Editor change selection to that item. I suggested using the search box or the Navigate button, but apparently they weren't right. The person wanted to paste a link and have the content tree change without any other clicking about.

So, in the spirit of being a helpful co-worker, I hacked up a quick command extension to solve this problem. It's trivially simple, but I figured someone else might find it useful, or learn something that helps them...

Templates and help, part two

Last week I talked about an approach to displaying template-related help fields in Content Editor. The last week has been a bit manic, so I've not managed to spend much time on extending these ideas, but I have a basic approach to displaying similar data in Page Editor. Quick one today...

Help! What does this template do again?

One of the challenges of building sites with Sitecore can be making sure that your content editors understand the purpose of each template and what data they're supposed to be filling in for each field to build up their site. This can be a challenge for complex sites – the data model required for building a complex and feature packed site can sometimes be difficult to explain to non-technical editors.

Historically I've usually tackled this problem though documentation and training sessions – but it struck me the other day that Sitecore itself should be able to help too.

So I've been experimenting with the basics of a really simple prototype for explaining templates. I'll explain a what I was thinking about for Content Editor this week, and hopefully offer some ideas for adding similar behaviour to Page Editor next week.

JSON web services when you're stuck in with basic ASP.Net...

Whilst it's nice and easy to create JSON services for your front-end JavaScript if you're working in ASP.Net MVC, things can be a bit more difficult to wire together if you find yourself with project requirements that force you to work with the older bits of ASP.Net. Getting the JSON inputs and outputs to work can caused me some head-scratching.

Having had to make this work recently, I thought I'd write down where I ended up after searching Stack Overflow and MSDN...

C# JSON Web Services ~4 min. read

Multilist fields with source queries in Parameter Templates

I've talked previously about how you can improve your content editors' understanding of where things live inside your Sitecore content tree by making use of relative queries to specify where the editing UI finds things. You can do it Data Sources.

Logically, you'd assume that if a relative query works for a Multilist field in a normal template, it should work in a Parameter Template too? Well, if you set up something like this:

Late to the Post-Step party...

I was creating a quick package to transfer some content between Sitecore instances the other day, and happened to scroll down to the bottom of the Metadata page in Package Designer. Not for any real reason – just some over-enthusiastic scroll-wheel action. But when I looked at the dialog, it struck me that there were two fields here I'd never paid any attention to before:

Faceted Search in Sitecore 6.6

Last week I spoke at the London Sitecore Technical User Group, and discussed my experiences working on a project that had to provide a Faceted Search UI in Sitecore 6.6. As part of my example, I talked about how you can build Facets using Lucene when you don't have access to the newer search APIs available in Sitecore 7.x, and about how you can make your search UI configurable by editors to improve their user experience. And I said I'd post my example code and explanation. So here goes:

Custom Sitemap Files – Part Three

The third part of this series is to look at how we can add images to our XML Sitemap files. We've looked at the configuration and the basic code to get entries into Sitemap files in the first two posts.

Getting images into the sitemap requires two things: First specifying some rules for what images to include, and secondly some code to extract those images from the content and write them into the index files. The code to deal with images that are specified in fields on the web page item is easy – but we also need to deal with the situation where the image is referred to by a component that has been dynamically bound to the page.