Internet-Facing Sites with SharePoint 2010: Tips, Tricks, & Gotchas

This post will be a collection of the lessons I have learned over the past 14 months building internet-facing SharePoint sites. I will add to it as I remember things I have learned ūüėČ

 

  • Start with a solid base. I have used two different starter masterpages, one from Randy Drisgill ¬†(used on ms.gov) and one from Kyle Shaeffer ¬† (an altered version was used as the base for Its.ms.gov)
    • I edited both and added customizations to suite my needs. I used Kyle‚Äôs for a responsive site, though I took the ribbon code from Randy‚Äôs and made some other alterations.
  • If you are going responsive, use a solid framework. I used a modified version of Twitter Bootstrap along with my modified masterpage from Kyle Shaeffer. Kyle includes some SharePoint resets and a script that helps to counter some SharePoint wackiness when going responsive.
  • I design internet-facing SharePoint sites the same way I do any other type of site. I create a mockup and then build it out in Dreamweaver using HTML 5 and CSS3. Of course, having a strong knowledge of SharePoint helps in deciding what element s of my design should be lists, which should be data views, and which should be some groovy JQuery thingy that I need to pull my developer in to build. Once I build out the unique pages (usually home, sub, full width layouts) I then test these in IE 7-9, Chrome, FireFox, and Safari. I make any corrections for IE and then I pull the designs into SharePoint Designer.
  • I have found that no site that works perfectly outside of SharePoint will work perfectly once inside. I usually have at least a few minor CSS issues to correct, generally having to fix any CSS declarations for global tags, like ul‚Äôs and img‚Äôs. I try to make all of my styles contextual so as to not override the ribbon or editing interfaces.
  • When things don‚Äôt work correctly, I find that I usually have misspelled something. I have a habit of spelling Bootstrap as Bootsrap-I wasted an hour trying to figure out why my grid was collapsed until I realized my spelling error.
  • Fun With Anonymous Access
    • Internet-facing means anonymous access. This means that many features of SharePoint are no longer supported without being logged in. For example, I had hacked a list entry form to serve as a contact form. User adds their info, hit the button, data gets sent to list, which kicks off workflow that emails user‚Äôs contact info. A simple solution that removes the need for a developer to create a table in a database and having to code out an entry form.¬† While this works perfectly in a authenticated environment, the minute we turned on anonymous access in our UAT environment, the login popped up when users went to this page. Anonymous access won‚Äôt allow adds to lists by non-authenticated users by default. So scratch that solution.
    • ¬†Also, if you don‚Äôt turn off mobile rendering in Central Admin, your internet-facing site will force a login to display on mobile phones. You want to turn this off for another reason-mobile rendering is horrible; it‚Äôs literally a list of links, and not the ones you want your users to see.
    • JavaScript also has issues with anonymous access. Our developer had used JavaScript to query lists and pull back data for several directories on ms.gov. We noticed issues in IE 7 first. We got those fixed and then when we tested with anonymous access we realized we had a problem-login prompts. I blogged previously about these issues. Thankfully Marc Anderson tipped us to his wonderful SPServices JQuery library and our developer was able to get his directories working with anonymous access. If you plan on using JavaScript to query lists or services, save yourself some misery and check out SPServices first.
  • Why So Slow?
    • We know the trend in web design now is large photos EVERYWHERE! That‚Äôs great and all, but SharePoint tends to be slower than regular websites already, adding huge images just makes it worse. We optimized all of our images as much as possible, made sure we used progressives jpegs, minified our css and js files, and still ms.gov was just too slow. I stumbled upon a setting in Site Settings that I had never noticed before: Site Collection Output Cache. Turn this on and set your profile to Public Internet and you should find that your site starts to perform better.
  • Large Lists Not Displaying for non-admins
    • If you have a list with more than 5000 items and you are querying it and the results are not showing up for non-admins, have your farm admin adjust the list view threshold. The default limit is 5000; raising it above the number of items in your list will allow the queries to function properly. If you have several lists that have over 5000 items you might want to look into other methods for handling so much data, but in a pinch this works well. Note that this setting is on a per site collection level.
  • Publish!
    • Ever run something all the way up the flagpole to production and then notice either missing image icons or logins popping up randomly? I bet one or more of your files¬†isn’t¬†really published. Depending on how your site was set up, you may have lists that require approvals before the assets are published, or you may have checked an item in and not published it. Go to site actions > Manage content and structure, and view all of the items in draft mode. This goes for reusable content list items as well.

SharePoint 2013 Preview Screenshots

Below are some screenshots from a cloud-hosted version of the SharePoint 2013 preview.

Site Contents

Site Contents

Settings


Design Gallery

Display Templates

Embed Code

Looks like MS figured out that we have been using the CEWP for mostly embedding code into our pages and have now given us the explicit option to do so now.


SharePoint Designer: Goodbye Design View ūüė¶

So with no design view in Designer, how does one see what the heck they are doing? There is still the option to create data views, but I cant figure out how to connect the DVWP to a list or how to see what I am doing to mess with the xsl. This is a change that I find very strange as it massively handicaps those who do customizations. Sigh.

That’s all for now. As I learn more I’ll post more.

Making SharePoint Responsive, Part 1

The hottest web trend right now¬†seems¬†to be “Responsive everything!!!!!!”. Well-done responsive websites are a good thing but are not¬†necessarily¬†easy to create. I recently had to retrofit a web application to make it mobile optimized and it was fairly painless, though trying to make complex forms responsive caused some rework. My programmer’s eyes glazed a bit when I told him what he had to do to each field to¬†make¬†it flow ever so nicely. Retrofitting more complex websites seems like an impossibility-it really does pay to be mobile first and design your sites with responsiveness in mind from the beginning.

My latest SharePoint project, a state agency website, was not designed to be responsive. The agency¬†wanted¬†it to resemble ms.gov and the mock ups they approved were of a fixed-width design with a few tricky design elements I had no idea how to build.¬†Because¬†I love pain, I decided “Let’s go¬†responsive-with SharePoint!”. I used Twitter Bootstrap as my flexible grid and I created the base site design in Dreamweaver, as I do with all my sites. I tested it in IE and Chrome and my little media queries were working great. Then I pulled the code into SharePoint. And then the real pain began.

I use Randy Drisgill’s base masterpage as my starter for all my SharePoint sites, so I used it here as well. Unfortunately, for some reason when the viewport hit around 777 pixels it simply refused to respond any further. I removed all of my code line by line to see what was making SharePoint so angry. It was not¬†the css, it was SharePoint, specifically,¬†something¬†being¬†called from¬†my¬†masterpage. So I decided to try Kyle Shaeffer’s v5 Responsive masterpage. I added it to the site as is to verify that it worked before I made any changes. Happiness-it responded, no dreaded 777 pixel dead end. The masterpage has a bunch of controls ¬†I never use so I stripped those out. The css was missing the magical code that makes images responsive so I added that. I pulled over the parts of Boostrap that¬†mattered¬†to me, the fluid grid classes, and left out all the non-grid styles. I integrated my code and voila! After, oh, maybe we are at 30 hours at this point since I rebuilt the masterpage like 4 times, I finally thought I had this sucker figured out.

I found the next issue when I started building out my page layouts. Certain admin screens, like checking in masterpages, site columns, contents types, pulled up an error. SharePoint has such lovely and useless error messages, they might as well say “you broke it You so dumb!” Eh. So today I opened my masterpage on one monitor, my standard masterpage on another, and I went down line by line and made sure every control that was in my regular masterpage was in my new one. The dreaded¬†errors¬†finally went away when I added all of the hidden controls. My regular maserpage had 20 hidden controls and my new one only had 16. Once I added the missing four the error just went away-I jumped up and¬†squealed¬†and decided I had earned a lemon ice for all my troubles.

I am happy to report that so far I have encountered no further issues with my new responsive masterpage. I am currently building out the page layouts and trying to get the site ready to start dumping content into it. I hope to launch this baby sometime next month. I still have several other technical challenges to overcome for this website, but I think I finally feel satisfied that I have created a fully responsive SharePoint 2010 site. I sooo need a nap..

More to come!