I recently assisted a customer with developing a site template to manage individaul projects. Part of the site template is a customer Top Link bar and Quick Launch bar. By default, entries in the bars either reference particular lists, libraries or sites. The customer was more interested in linking to specific Web Part Pages. The customer thought this was simple enough, just simply go to Site Settings then either Top Link or Quick Launch and remove all existing entries and add their own custom entries. Wala, they had a customized Top Link bar and Quick Launch bar that links to all the appropriate pages, life was good.
Well as I mentioned they were going to make a site template out of the existing site to deploy the same layout for other sites. After creating a new site from the site template, they tried the custom links and they soon discovered that instead of referencing Web Part Pages i n their existing site, it was referencing links in the original site. "How do I create entries in the Top Link bar and Quick Launch bar so they reference their own site and not the original site?" they asked me.
That is where Relative links come in. In their example above, they were using what we call an Absolute Link, for example http://www.DomainName.com/PageName.aspx. This creates a static URL to a specific page instead of a dynamic link. A Relative Link on the other hand is more of a dynamic URL, for example /PageName.aspx. When you enter a Relative Link, the browser assumes automatically that the location you are at is the beginning of the URL and it will append the /PageName.aspx to the end. So in our example, the original site and page URL is -
http://www.domain.com/ProjectA/Search.aspx
The second site and page URL is -
http://www.domain.com/ProjectB/Search.aspx
As a result, if I add an entry to either Top Link bar or Quick Launch bar with a URL of /Search.aspx, if I am at ProjectA site, the /Search.aspx will be appended to http://www.domain.com/ProjectA, and if I am at ProjectB site, the /Search.aspx will be appended to http://www.domain.com/ProjectB.
In both examples above, we assumed that the aspx pages existed in the same site as where the user resided, but what if the aspx page existed in a sub site of both Project sites? You would simply continue the Relative path link. For example, /SubSite/Search.aspx means the Search.aspx page exists in the Sub-Site of the site you are currently in.
Posted
May 02 2008, 07:00 AM
by
Jeff Kozloff
Jeff originally joined Bamboo Solutions in June of 1999 as a part-time Test Engineer (basically a gopher). He continued with Bamboo as a part time tester while obtaining my Bachelors of Science in Computer Science degree at Longwood University. Upon graduation in 2004, Jeff accepted a full time position at Bamboo as a Helpdesk Specialist and became Manager of the Helpdesk team in 2006. In October of 2007 until present, Jeff took a role as Project Manager in the Solution group bringing his in depth technical knoweldge of SP to Bamboo's customers.