SubscribeMainTagsEditHistoryDiscussion

  1. Introduction
  2. Creating the template
  3. Default template

Introduction

This page describes the way to change the templates svnwiki uses to generates pages in the wiki.

The Svnwiki developers urge you to only change the template if you have a specific reason to do so. In general, Svnwiki users should not need to change the template but should use Subversion properties to control the behaviour of the default template.

Creating the template

Create a file template somewhere. Set the svnwiki:template property on the files or directories on which you want the template to be used to the path to the template file in the wiki beginning with a slash (eg. /weblogs/galactus/files/template). You'll probably want to set the svnwiki:ignore property on the template file to cause svnwiki not to render it and the svnwiki:frozen property to cause svnwiki not to let people change it through the web interface.

The template should be an HTML file with all the tags you want to use. To include information from the page you'll use the format codes:

%p
Shows the path of the current file.
%P
Shows the list of popular tags in the current directory.
%r
Include this inside the <head>. It shows <base href> and <link> tags (e.g. RSS, CSS) when it has to (and in the future it will include other tags, most coming from Subversion properties on the files).
%t
Show the title of the current page as text. The title comes from the path and svnwiki:title properties.
%T
Show the title of the current page as HTML. This is identical to %t but includes links.
%h
The Edit, Discuss, XML, Stats and related links.
%i
The contents of the file to which svnwiki:header points to (or, in absence of svnwiki:header and up until 2009-01-01, the svnwiki:toc).
%I
The contents of the file to which svnwiki:footer points to.
%v
Show the revision (version) of svnwiki that was used to render the file.
%b
Show the list of back links (pages linking to the current page) inside a <ul> list.
%c
Show the content of the page.
%E
Show the name of the character set the file uses.
%e
Show warnings about the page (currently the only one is this page has no tags). You should always include this in your template (probably above your content); if you want a certain error not to be shown, use the svnwiki:ignore-errors property.
%l (obsolete)
Show the pages linking here list. This sequence is obsoleted by the %b sequence.
%L
Show the date of the last update to the current page.
%s (obsolete)
Show the URL to the cascading style sheet, from the svnwiki:css properties. This is obsoleted by the %r sequence.
%S
Show a search form if the search functionality is available.
%w
Show the URL of the application (the svnwiki.cgi location). If you want to make links to the application, start them with this code.
%T
Show the list of files related to the current one (based on their tags).

Keep in mind that the list of sequences could change in the future. If you decide to use your own template, you may have to update it in the future to stay in sync with the latest changes in Svnwiki (so you benefit from new features added to svnwiki and your template doesn't break).

The following is the list of changes made since r9545:

You can also see the list of special characters and their associated code in the function render-template in the render.scm source code file.

Default template

The following is the default template:

<?xml version="1.0" encoding="%E"?>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <title>%t</title>
  %r
 </head>
 <body>
  <div id="header" class="header">
   <h1>%T</h1>
  </div>
  <div id="toc-links" class="toc-links">
   <div id="toc">%i</div>
   %S
   <div id="backlinks">
    <p>Pages linking here:</p>%b
   </div>
  </div>
  <div id="content-box" class="content-box">
   <div id="info-box" class="info-box">
    %h
   </div>
   <div id="content" class="content">
    <a name="top"></a>
    %e%c
    <div id="last-update" class="last-update" align="right">
     <p class="last-update">Last update: %L</p>
    </div>
   </div>
  </div>
  <div id="credits" class="credits">
   <p><a href="http://wiki.freaks-unidos.net/svnwiki">svnwiki</a> %v</p>
  </div>
 </body>
</html>

Note: the use of the class attribute for unique elements (header, toc-links, content-box, info-box, content, last-update and credits is deprecated. The classes will be removed from the default template in the future. The id attribute should be used instead.

The default template is built for Svnwiki by the svnwiki-default-template function in the shared.scm source code file.

Last update: 2007-09-29 (Rev 12967)

svnwiki $Rev: 14721 $