Wiki Tutorial: TOPICTITLE

By default, the Wiki puts (a slightly modified version of) the breadcrumb path into the web page title. Often, this isn't a problem. However, when doing Wiki applications, I end up with pages whose names are, effectively, database keys (e.g.: ProjectDetail200707p2).

I want to set the page Title to show something easier for the human reader to grok. With a bit of Wiki "skin" magic, this is easy.

(Note - As of Version 6.0, TWiki includes support for a TOPICTITLE without the need for an additional skin/cover. See TWiki:TWiki.VarTOPICTITLE.)

Add the "local" skin (cover) to WebPreferences

This causes Wiki to include an additional template for the look and feel of each page.

   * Set SKIN = local, pattern

Technical Details

The "local" skin preference imports the view.local.tmpl template definitions.

This file lives on the Wiki server; once it exists, no additional modifications are required. Just turn it on in WebPreferences.

See Skins documentation for why this works.

If you want the nitty gritty details, here's what's in the file:


%TMPL:DEF{"normalwindowtitle"}%<title>%TMPL:P{"titleaction"}% <nop>%TOPIC% %TMPL:P{"titlesep"}% %WEB% %TMPL:P{"titlesep"}% <nop>%WIKITOOLNAME%</title>%TMPL:END%

%TMPL:DEF{"dbwindowtitle"}%<title>%TMPL:P{"titleaction"}%<nop>%TOPICTITLE% %TMPL:P{"titlesep"}% %WEB% %TMPL:P{"titlesep"}% <nop>%WIKITOOLNAME%</title>%TMPL:END%

%TMPL:DEF{"windowtitle"}%%TMPL:P{"titleaction"}%%IF{"defined TOPICTITLE" then="%TMPL:P{"dbwindowtitle"}%" else="%TMPL:P{"normalwindowtitle"}%"}%%TMPL:END%

Set The Desired Page Title

Once you're using the local "skin" addition, you can override the page title on any page by setting the TOPICTITLE variable to whatever you prefer.


A common use case is with pages that are part of Wiki applications. Each page has a form attached; use one of the form values to customize the page title.

   * Set TOPICTITLE = %FORMFIELD{"ProjectName"}%

To include the topic (page) Wiki name as well, use.

   * Set TOPICTITLE = %FORMFIELD{"ProjectName"}% %TOPIC%

To ensure that there is a title if the named form field is empty, you can use

   * Set TOPICTITLE = %IF{"$'FORMFIELD{TutProjectName}'", then="%FORMFIELD{"TutProjectName"}%", else="%TOPIC%"}%

Set TOPICTITLE in your application page template and all pages will inherit it.

How To Set

You can set the variable in one of two ways:

Method 1: Set the variable directly in the page using the Wiki editor. If you do it this way, wrap it in an HTML comment so it doesn't show when the page is viewed.

   * Set TOPICTITLE = 

Method 2: Set the Variable in the "Topic Preference Settings".

  • Click "More topic actions" at the bottom right of the page.

  • Click "Edit settings" for this topic

  • Enter the variable setting as you normally would. Click Save.
      * Set TOPICTITLE = 


  • Default (screenshot):
  • with TOPICTITLE (screenshot):

-- VickiBrown - 23 Jul 2008

Topic revision: r4 - 02 Dec 2014, VickiBrown
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email