Navigation for Wikis
The Wiki functionality SharePoint offers is great for quickly writing down stuff. It is often used for Server documentation.
Creating new pages is easy, and you can link pages. The ability to format the text is nothing fancy, but most of the time enough 🙂
Uploading images can be done with my custom field type, which stores images and documents in existing libraries. After the upload, a link is inserted into the Wiki body. –> Custom Field – Upload Files and Images
Now I want to introduce the navigation for SharePoint Wikis.
I realized the navigation through a control adapter. It extends the history button, which is shown on every Wiki page. The advantage is, that the navigation will have to be activated only per web application. Every Wiki page within that web application then has a navigation control beneath the Quick launch. You can see the navigation in action in my Wiki.
How does it work?
The start page in a Wiki library is used as root for the navigation. The text “Wiki Navigation” is linked to this start page.
Every link on this start page which points to another Wiki page is followed to create the navigation tree.
The navigation is cached for 20 minutes. But if a page changes within this time, the navigation will be rebuild and cached automatically.
The Wiki Navigation uses the same CSS as the Quick launch TreeView. This way it does not break the layout, if a node text is too long.
If you Wiki was created from the Wiki site template, it will use the same page for the navigation root you see when you browser to your page (usually the home.aspx).
But if you created a Wiki library on e.g. an empty Teamsite template, the Navigation uses the first Wiki page it will find inside the Wiki library. This is usually the “How to use this wiki library” page. You have to manually delete this page, so the homepage is the page with the lowest ID (see in the url if you edit a Wiki page).
URL Parameters
The Wiki Navigation can take three URL Parameters, to change the way it renders the navigation.
- Refresh=true
This parameter will clear the cached data, reload it and store it in the cache again - ExpandDepth=x
Controls the depth TreeNodes are expanded. The path to the currently selected TreeNode is always expanded. - MaxLength=x
Shorten the TreeNode text to this length and add “…”
Requirements
WSS and .NET 3.5 (SP1)
WSPBuilder Extensions for the Visual Studio if you want to user the source code
Installation
Add the solution via stsadm. Deploy it to the web application where you want to use the navigation. Then activate the web application feature.
Download
SharePoint Solution RH.WikiNavigation.wsp
Source code RH.WikiNavigation-Source.zip
Update 7/20/2009
Fixed a bug with Wiki Libraries created without the Wiki page template
Update 8/10/2009
More Trace output during feature activation/deactivation.
The control adapter is now available on every UrlZone configured in Alternate Access Mappings.