In an effort to follow my trend of writing helpful tips for SharePoint Administrators and End Users, I present to you yet another hopefully good tip. While the title may be slightly interesting for a SharePoint blog, it exhibits the true affect that I’m writing about. For most SharePoint users, they are participating without even knowing it. You may be asking "how?" and there's a simple answer.
See, when creating titles in SharePoint, we don’t really think about how they can affect us until after we create them. If you go to the Document Library > Upload your document > Add the title, you assume you're done right? The same is true for site columns or list/libraries. We simply give it the name we want and go about our way. That is until we try to remember the URL or share the document with someone only to find a terribly confusing and illegible URL to send.
This blog will explore how simple it is to completely screw up titles and URL’s in SharePoint and well, how to not do that.
Review the problem
I’ve been doing SharePoint for a pretty long time and web designing for even longer, but I’m not revealing my age. :) Over the years I’ve seen a lot of SharePoint intranets, extranets, and everything in between - from portals to applications and solutions. It always amazes me when I see a URL reference that is illegible because of all the excess characters or cases in the URL structure.
Here’s a quick test to validate something for yourself. Which one is easier to read?
Of course anyone in their right mind would say #1, yet how many of us ensure that our URL’s end up that way on purpose? Oh and don’t try going to those links, they are fake, but the contest is real. More details at the end.
Since correctly naming and building URL’s doesn’t require rocket science (seeing that I’m in the rocket city Huntsville, AL) I figured I’d give a helpful tip to eliminating such from your SharePoint environments.
What’s in the URL?
There are lots of things in the URL, but for this blog I am focusing mainly on the title of whatever is being referenced. When creating a URL there are three considerations to take into account:
- Determine a consistent naming convention
- Decide on your case type, abbreviations and character usage
- Keep it short and sweet
The naming convention is how you will write out the names, titles or whatever your URL is capturing, whether it is a web page, web site, document or spreadsheet. This could be preset by your organization or you may be the person responsible for such, either way follow the same thing all the time.
Note: consistency is your best friend for these.
As for case type, you can choose between title case, lower case, upper case, mixed case, and camel case. If I missed one, add a comment and let me know.
My personal preference is using “CamelCase” whenever possible. It helps readability of a URL and keeps them clean and consistent (see what not to do below).
CamelCase can be tricky with longer URL’s or URI’s but the goal is to provide a similar structure whenever possible. Abbreviations and character usage is dependent upon the organization and needs, but I would use consistency and keep things as short as possible whenever possible. Click here for the Wikipedia definition of CamelCase.
Applying this to SharePoint
When creating a new list, library, page, item, column, document or a host of other things, SharePoint present us with this field like the image below that tends to mislead a lot of users.
Or this one for columns:
Of course the page varies depending on the version and if you have Silverlight installed, but you get the point. If you aren’t looking or reviewing what SharePoint is doing, you may not correlate that the data you input here becomes the URL that is used for the item. So in following the above three suggestions your titles for most of these should contain a CamelCase name such as ExampleColumn, NewCustomList, ActionItems, etc. This is a good habit to get into as it helps trim down your URLs upon creation.
The second thing to consider is spacing and characters. We all have seen the infamous %20% or a host of other obscene URL’s like the example below. If you tried to retype that, you could end up in a nightmare.
Those extra characters are a pain to try and read through. All that junk in the URL can distract users from the real title they may need to see or read to quickly identify where they are. A common error in SharePoint URL’s can be seen from the space or “%20.” In order to help eliminate that, get your users or yourself in a habit of eliminating spaces whenever possible by using dashes or underscores if needed so their URL can look like the following example.
Note: both images were taken from a development site and produced for the sake of this blog, this was not created in Photoshop.
Once you've created your column, list, library or site, go back into the settings for it and modify the title and description and then add your spaces back in. This will change the display name that’s used, but the URL itself will be nice and clean.
Here are some quick steps via screenshots on this process
- Enter your title and hit create
- Click on the title for your newly created item
- Navigate to the settings (in this case I was using a custom list)
- Click on title, description and navigation to access the edit screen
- Modify the title to include spaces and click okay
- View your modified display name and your good URL name
Summary and Recap
- Keep your naming convention the same across the board
- Define your case type and stick to it (Recommended best practice is CamelCase)
- Eliminate long names and characters by using abbreviations when possible. You know “Short and Sweet”
Using underscores or dashes is acceptable, but I still prefer to eliminate as much as possible. Here are what is allowed inside a URL:
- alphanumeric characters (A to Z, a to z, 0 to 9)
- The following characters: -_.!~*'()
- The following characters are allowed only if they have been reserved with a special meaning and previously defined on the server. ;/?:@&=+,$
My goal isn’t to tell you what you can’t do but to encourage good principles and simplicity to make your SharePoint life easier by keeping at least your URL’s clean.
Here is good solution that can be used to generate shorter URL’s. Thanks to CodePlex and Jan Tielens for this. http://spgetshortlink.codeplex.com/
Project Description - JanTielens
A SharePoint 2010 Sandboxed Solution that enables URL shortening, for easier sharing of documents stored in a document library. Works both for SharePoint in Office 365 and on premises.
The Ugly URL Contest
Think you can find the ugliest URL? Simply take a screenshot or copy and paste the URL in the comments below. This isn’t limited to SharePoint either, but those are greatly welcomed. One person will receive a Starbucks Gift Card. I don’t drink coffee, but that doesn’t mean I can’t give it away. The Winner will be announced in a later blog post and on LinkedIn, so stay tuned, it could be you!