In our Introduction to SharePoint Foundation / Server 2010 course, we briefly mention that SharePoint limits the total URL length of any location in a site: Depending on some variables, it can be up to 256 to 260 characters. (See http://technet.microsoft.com/en-us/library/ff919564.aspx for a technical explanation.) In addition, you’ll run across a 255-character limit for URLs in lots of other places. For example, if you want to paste a link into an email, your email program may not accept URLs longer than 255 characters. In some SharePoint sites it can be surprisingly easy to hit that character limit. Some of the things that can eat up SharePoint URL space are:
- Long names for lists or libraries
- Use of folders and subfolders
- Long names for documents or list items
- Multiple levels of subsites
In this post I’ll discuss how to help keep that length under control by smart management of lists and libraries.
Optimize the SharePoint URL When Creating Lists and Libraries
First, let’s look at what happens when you create a List or Library. (In the example below, we’ll be working with a Library, but the same principles apply when working with a List.) When you open the Create dialog box, the first field that you fill in is Name. Whatever you type in as the name becomes part of the URL for that List or Library. Browsers cannot understand certain special characters, though, so they can’t be used in URLs. Spaces are one such special character, so SharePoint replaces every space with %20 to encode it in a way that browsers will understand. For example, let’s say I need to create a Library for policies and procedures on the Human Resources subsite of an intranet Site Collection. I might be a bit verbose on top of that, so I name my new Library Policy and Procedure Documentation. SharePoint uses the Name as both the display name (for the Library page, the Quick Launch Bar, etc.) and the library URL. In the URL, the %20 code is used instead of the spaces. So, I end up with something like http://intranet/sites/humanresources/Policy%20and%20Procedure%20Documentation. In addition to being long, the URL is also not very user-friendly – the space encoding makes it difficult to “read.”
So, how do we create Lists and Libraries in such a way that the URL will be shorter and more user-friendly, while also having as descriptive a display name as possible? The trick lies in creating the List or Library with a brief name first, then going back and updating the display name. For example, in my Human Resources subsite I’ll go to Site Actions > New Document Library to open the Create dialog box. Instead of naming it Policy and Procedure Documentation, I’ll name it policies. If I really wanted to include “procedures” in the URL, I might do something like policies_procedures, substituting an underscore for a space.
(Note that I also turned on Versioning for this library; more about that later.)
After I click Create in the dialog box, I’ll have a library that looks like the example below. The URL includes policies, and that’s also the display name in four locations: The descriptive text below the column headings, the breadcrumb navigation at the top of the page, the link in the Quick Launch Bar, and the browser tab (page title):
Since I want that display name to be more formal and descriptive, now I’ll go into the Library Settings to modify it. I’ll click on the Library tab under Library Tools, then click on the Library Settings button.
In Library Settings I’ll click Title, description, and navigation under the General Settings heading.
On the next page, I’ll see that the current Display Name is policies. I’ll change that to my preferred Display Name, Policies and Procedures Documentation, and click Save.
before:
after:
Returning to the Library, I see that my display names have updated, but the short, user-friendly URL hasn’t changed.
SharePoint URLs with Folders
When creating folders, not only do you have to be aware that a folder just creates another level in the URL path, but you are also limited to no more than 128 characters when creating a folder name. As we discuss in the Introduction to SharePoint 2010 Foundation / Server class, the best practice in SharePoint is to not use folders at all, but to use metadata (columns) to categorize items. By using this flat structure with metadata, you can categorize items in a number of ways instead of just one way as you would with a folder. In addition, you can then create views to display the items according to a wide range of sorting, filtering, and grouping criteria. These metadata terms are also available as Search criteria. There are times when a folder is truly necessary, such as when a group of items has a unique permissions requirement. Otherwise, however, use metadata.
For example, in our Policies and Procedures Library, we might have had one folder for Policies and one for Procedures. Instead, I’ve set up the library with multiple metadata Columns so that each document may be flagged in a number of ways by going to the Library tab -> Library Settings button -> Create Column link.
For detailed information about using metadata and views, see our free online video SharePoint 101 – What Makes SharePoint Work.
Item Names and SharePoint URLs
It is also helpful to refrain from having document names that are very long. In the example above, there is a document called Employee Dress Code Policy – Revision 06-2012. SharePoint converts spaces in names to %20 for the purposes of a URL, since browsers can’t understand some special characters like spaces. So, the URL for that document would be http://intranet/sites/humanresources/policies/Employee%20Dress%20Code%20Policy%20–%20Revised%2006-2012. Smart document naming and management habits can keep that name shorter and more intelligible. First, the word “policy” could be dropped, since the Category flag already indicates that it’s a Policy. It could also be argued that the word “Employee” could be removed, since it is implied that the policy applies to the company employees. Next, the revision information can be removed. For one thing, each item has a Modified date/time stamp, so the last revision date is easy to view. In addition, by turning on Versioning as we did when we created the library, we can avoid the phenomenon so common to shared drives: Multiple copies of a document are stored, each with a different revision date. All of the revisions are tracked in this single document and can be viewed, or even restored, at any time.
Bonus Tip: Subsites and SharePoint URLs
When you create a subsite, you have an advantage that you don’t have when creating a List or Library: Separate fields for specifying the name and the URL. You might have a site name that’s spelled out (Human Resources) but you are not stuck with that as the URL. In the example above, it makes sense to use the common acronym for Human Resources, HR. So instead of http://intranet/humanresources, I can use http://intranet/hr. Just be sure that if you use acronyms or other shortened names for site URL paths, that it’s something that will be reasonably intelligible to the users.
By combining best practices for naming, document management, and List / Library management, you can keep your URLs to a reasonable size as well as improve the functionality and ease of use for the site as a whole. Learn more about SharePoint List and Library management through our SharePoint 2010 training and SharePoint 2013 training classes.