So, might not be news, but SharePoint’s out of box Page Layouts suck. I’ve already described how the page layouts have an image on branding, introducing styles to change the navigation, etc.. This has led me to the conclusion that you shouldn’t use the out-of-box publishing sites – start from a minimal publishing site, and build from the ground up.
But what of customers who have naively thought that, I don’t know, a Collaboration Site Template might be a good template to use for the collaboration site? Well, this is the problem I’ve got now; a customer has used the out-of-box page layouts extensively, and now wants the styles of the text and so on to be consistent. How can I do that? Well, that’s where things get tricky. For Page Editor controls in some page layouts they are within a <div> tag using the PageContent style. This is true for the Article Page page layouts, and some of the Welcome Page layouts:
Yup, that grey text in Tahoma font is actually defined by the CSS class of the enclosing <div> tag. But here’s the problem. Some of the other page layouts don’t have the <div> tag and PageContent CSS style. There is little we can do about all of them, other than adding the <div> tag onto the remaining Page Layouts; we could try changing styles further up the structure of the page, but that could change a lot more too – and my customer isn’t ready to embark on a full rebranding.
To make matters worse, they have some custom page layouts which use the Telerik RadEditor control. Now, this is fine in Display Mode, but in Edit Mode the RadEditor puts the text to be edited into an IFRAME – which is now out of the styling scope of the enclosing <div> tag! Display view – grey Tahoma text. Edit view – black Times New Roman!
So, how did I deal with that? Well, in the CSS file that defines the styles for the RadEditor (I’d created one and configured the RadEditor to use it) I defined a <body> tag with a style that matched the style of the surround <div> tag. It’s a bit of a hack, but at least it did make the text appear the same in Edit and Display modes.
Why so much harder than it should be, though? Couldn’t the page layouts have been consistent? What’s with all the rubbish page layouts anyway? Only the Article Page layouts make sense!