Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The head tag in MOSS 2007 generates extra spaces while rendering the contents. When doing SEO audit this seems to be a problem. Is there any way to control this behaviour?

I see this problem in MVC architecture also. It says it is the dll which renders it and nothing can be done.

(I understand the importance of Head tag playing around would bring adverse effects.)

share|improve this question
    
Can you show us some code sample? May be your master page and page layout? –  Karthik Murugesan May 12 '11 at 5:28
    
<head id="Head1" runat="server"> <title id="onetidTitle"><asp:contentplaceholder id="PlaceHolderPageTitle" runat="server"/></title>- Master Page –  Thomson May 12 '11 at 8:11
    
<asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server"> <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/></asp:Content> - Page Layout –  Thomson May 12 '11 at 8:11
    
Here's the <head> element of Stack Overflow: pastebin.com/raw.php?i=5rWHf7gc . No SEO Problems. –  Kobi May 12 '11 at 8:13
2  
See also this question: Do tabs, spaces, and line-breaks in HTML markup affect search engine optimization? I just had to check because it sounded suspicious, hope that's OK. That said, SharePoint 2007 has mostly ugly markup, and it might hurt your SEO much more than a few spaces –  Kobi May 12 '11 at 8:14
add comment

1 Answer 1

SharePoint hasn't typically been a good citizen for providing standards based HTML markup that's ideal for SEO (accessibility is another big one).

Your only option is to modify the markup once SharePoint has finished with it, and that means writing an HTTP module. This will allow you to alter the raw HTML in any way you wish before it is sent back to the user. Here's a walkthrough on how to write one. Review the HttpApplication Events to ensure you hook into an event firing at the correct point of the ASP.NET Lifecycle.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.