Quicklaunch navigation will not show a link if it’s set as the home page.

Today I had the requirement to include a link in the quick launch menu to the current web’s homepage. Agreed it’s a strange requirement, but nonetheless in this case it was arguably not too bad.

However the default SPNavigationProvider does not display the homepage in the quick launch menu. In order to do this add the link as an external page, even though it’s not.

using (SPSite site = new SPSite("http://localhost"))
	using (SPWeb web = site.OpenWeb(""))
		string url = web.ServerRelativeUrl + "/Pages/MyPage.aspx";
		WL("Adding..." + url);
		SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;				
		SPNavigationNode newNode = new SPNavigationNode("MyLinkTitle", url, true);
Tagged , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: