Sunday, August 26, 2012

Minimize page size for Public Website


In order to minimize the page load times and page sizes for anonymous users that do not require all the SharePoint scripts (because they can't use the ribbon anyway) can be done by combining the ideas of my previous posts.

Here's how:
1) Deploy different masterpage for the anonymous/public side and the authenticated/CMS side
In the anonymous one you can get rid of fall the stuff that's only useful for the CMS side, like the ribbon and all the styling required for it. The CMS side is a normal SharePoint masterpage.
2) Switch between the masterpage when the page is loading based on whether the Page is in edit mode or whether the current zone is the public one or the authenticated one. Here's a code example of doing this by extending the SharePoint Pages class. This should also by possible by using a HTTPModule, when I have a code example I'll post that one too. 
3) That's it!

Look at this example of a working masterpage that is quite minimal. It does still output some gunk that still needs removing, but the page size already dropped by 2/3's. When I get it completely right I think it will drop by another 50%. (NB: It's an HTML5 masterpage so you should change some things, like the DOCTYPE, before you can use it as a normal XHTML masterpage for anonymous users)

No comments:

Post a Comment