Feature Proposal: New TOPICTITLE variable for topic display name
Motivation
In preparation for
TopicDisplayName feature, the
%TOPICTITLE% variable will expand to a nice display name of a page. The existing
%TOPIC% variable expands to the page name, and is typically restraint to a
WikiWord or acronym.
Description and Documentation
The TOPICTITLE variable expands to the topic display name in this sequence until found:
- Value of form field named "Title" (already in use by several TWiki applications such as Support forum)
- Preferences setting TITLE
- Topic name
%TOPIC%
The TOPICTITLE variable supports the following parameters:
-
topic="" - optional topic name, can be of form "TopicName" or "Web.TopicName"
-
encode="" - optional encoding, same like VarENCODE
The TOPICTITLE variable is used to show the display name instead of the topic name in various places:
- Topic lists, such as recent changes & search results
- HTML window title
The SEARCH format is enhanced to support a new
$topictitle variable that expands to the TOPICTITLE variable.
The
QuerySearch is enhanced with a new
topictitle field specifier.
As a next step (out of scope of this proposal) when
TopicDisplayName is implemented, the UI will be enhanced to support the topic display name:
- Create new topic - new field for topic display name
- Edit topic - read/modify "Title" form field if exists, else TITLE preferences setting
- Rename topic - new field for topic display name
Examples
Topic name is CorporateIdentity
- Topic has form field named "Title" set to "Corporate Identity"
-
%TOPIC% resolves to "CorporateIdentity"
-
%TOPICTITLE% resolves to "Corporate Identity"
- A SEARCH
format="[[$web.$topic][$topictitle]]" resolves to [[Web.CorporateIdentity][Corporate Identity]] link with link title Corporate Identity
Impact
Implementation
--
Contributors: PeterThoeny - 2012-05-10
Discussion
Accepted by
JerusalemReleaseMeeting2012x05x11.
--
PeterThoeny - 2012-05-11
If
TopicDisplayName is implemented as I've just proposed, do we really need TOPICTITLE variable/function rather than TOPICTITLE preference?
%TOPICTITLE{topic="..."}% would be able to be achieved by %META{"title" topic="..."}%.
The feature provided by the
encoding parameter would be missing.
But aren't there ways to do it in other ways?
One thing I don't like about %TOPICTITLE% referring to the title form field and then fall back to the TITLE preferences variable is that each topic can have at most one form and the form needs to have the title field to make use of this feature.
A form for an issue tracker would have fields: summary, description, category, priority, assignee.
A form for a bulletin board would have fields: subject, body, category.
Forcing them to have the "title" field is artificial.
A topic title deserves to be a new topic attribute as I proposed on
TopicDisplayName.
Another thing is TOPICTITLE logic to be put at two places - the actual %TOPICTITLE% function and %SEARCH{...}% template expansion with $topictitle.
This feels like an unnecessary complexity.
--
HideyoImazu - 2012-05-30
I actually already implemented and checked in this feature on 2012-05-12. I disagree on form needing a Title field. This is optional. If the Title field is missing, the title is falling back to the TITLE topic setting. That is it works transparently. I already prepared TWiki::Meta, it has a
topicTitle() to get and set the title based on this rule. The upcoming
TopicDisplayName feature will use this.
This was implemented and documented on 2012-05-12 in
SVN trunk:
- New TOPICTITLE variable
- New
$topictitle in SEARCH format
- New
$topictitle in query search
-
TWiki::Func has a new topicTitle() method to get and set the topic title
--
PeterThoeny - 2012-11-21
New related proposal:
ShowTopicTitleInLinks.
--
Peter Thoeny - 2013-01-27