SharePoint WIKI Templates
Written By: Knox Cameron -- 1/6/2011 --
(3359) comments --
Categories: Design, MOSS 2007, SharePoint 2010, SharePoint Foundation 2010, WSS3
< Prev -
- Next >
| Become a paid author
Wiki libraries are a great way for people to share "free form" information
with their team and wider audiences. They includes features such as letting you easily create new pages simply by creating a "forward" link to a page name that doesn't exist yet, as well as letting you review changes made over a page's history, and checking for "incoming links" to a page.
SharePoint's wikis are basic but functional. Some of the features SharePoint
leaves out, such as text formatting markup, is not required because SharePoint's native functionality is better. Plus you have other SharePoint functionality not typically found in wikis such as web parts, lists and libraries, metadata and so on.
The problem is that they can be a bit too
"free form": if you create a new page, it's always blank. Often, it would be
nice to create pages with a standard layout to show the user what information to
include. For example, you might create a wiki library to hold pages for team
members to share status information about each active project. It would be good
to have a standard layout with the project
name and manager at the top of each page. However, users have to know to add
that information each time they create a new page.
Unfortunately, there is no system of templates for wiki pages in SharePoint.
Not even in SharePoint 2010, where wiki pages have become the default page type
for non-publishing sites. There are some add-ons available to provide that kind
of functionality, such as the community kit in CodePlex, but they require
installation of components on the server.
The first is a solution for SharePoint 2007 (WSS 3) that creates a new page and copies
the content from an existing page into it. The second is a solution for SharePoint
(Foundation) 2010 that
uses the same remote commands as SharePoint Designer to make a complete copy of
an existing page.
Both of these solutions can be implemented as-is by an administrator without
programming knowledge. However, programming knowledge would let you adapt and
enhance the solutions, and would be useful if you need to troubleshoot issues.
Either solution could be used to support multiple templates - just follow the
steps again in the same or a different library.
SharePoint 2007 - copy content
For this solution, you will need to find some internal information about the
page that comes up when you create a new wiki page. To get this, you will need a
tool like the Internet Explorer Developer's Toolbar, available as a free add-on
for Internet Explorer up to version 7 (Download
details: Internet Explorer Developer Toolbar), but available as a standard
component in Internet Explorer 8 (press F12 to activate it). For FireFox, an
equivalent tool is Firebug.
The steps are:
Get a copy of the URL of the page that comes up if you select the
option to create a new page in the wiki library. Copy it from the
address bar of the browser into a NotePad file. It looks something like:
Use the Internet Explorer Developer's Toolbar (or equivalent) to get
a copy of the IDs of the page name field (an html INPUT control) and
page body field (an html IFRAME) on the CreateWebPage.aspx page.
- Open the toolbar then select the toolbar option to Select Element by
- In the page, click on the Name field. It will be highlighted with a blue
- In the developer toolbar, find the id property, select it and copy it to
- Repeat the same process to select the page body field. In the toolbar,
you will see that the iFrame that contains it is above it in the hierarchy.
Select the iFrame, then copy the id into NotePad as before.
Create the page with "template" content.
In the source (HTML) view of the page body content, put the tag <div
id=TemplateText> at the start of the template content, and </div> at the
end, to mark the content to be copied to the new page, for example:
Select Edit Page from the Site Actions menu (not the wiki "edit"
link) and add a content editor web part to the web part zone at the
bottom of the template page.
Open the properties of the content editor web part, and select the
button to edit the source.
Copy and paste the below script.
<P>To create a new project page, press the <em>Create project</em>
<P>This will run a script that opens a new browser window for the new
project page, then copies the template text into the new project page.</P>
<P>Give the new project page an appropriate name, then edit the body
of the page as required. Save the new page when you have finished.
When you are ready to publish the project page, add a link to it onto
the home page of the wiki.</P>
var sURL = "PUT_CREATE_PAGE_URL_HERE"
oNewWindow = window.open(sURL);
while (oNewWindow.document.readyState != "complete")
var control = document.getElementById('TemplateText');
if (control == null)
alert('ERROR template content not found');
var controlValue = control.innerHTML;
var NameField =
var TextiFrame =
<input id="AutoButton" type="button" value="Create project"
Replace the page creation URL, page name field ID and page body
field ID in the script with the values for your environment, which are
saved in your NotePad file.
Save the changes, and save the page. Then test!
< Prev -
- Next >