Navigation:  Reference > About HTML Templates >

HTML template variables

Print this Topic Previous pageReturn to chapter overviewNext page

You can use all global predefined variables and user-defined variables in HTML templates. In addition to this you can also use the following special predefined variables, which are only relevant in HTML templates.

Variables for use in topic page templates only:

These variables can only be used in topic page templates. They are valid in all HTML-based output formats (HTML Help, Browser-based Help, eBooks and Visual Studio Help / MS Help 2.0).

Variable

Content and/or function of the variable

 

 

<%DOCTYPE%>

Inserts the correct DOCTYPE tag at the beginning of the HTML output pages. This variable is essential in all templates and should not be removed. If you do remove it you will get an error message from the compiler.

<%DOCCHARSET%>

Inserts the correct character set information in the meta tags at the beginning of the HTML output pages. This variable is essential in all templates and should not be removed. If you do remove it you will get an error message from the compiler.

<%STYLESHEET%>

Inserts the reference to the CSS stylesheet containing all the styles information for your project. This variable is essential in all templates and should not be removed. If you do remove it you will get an error message from the compiler.

<%TOPIC_HEADER%>

Inserts the header of the current topic if it exists. If the current topic has no header the value of this variable is null. This can be different from the topic caption inserted with <%TOPIC_TITLE%>.

<%TOPIC_HEADER_TEXT%>

Inserts the header of the current topic as plain text. This is particularly useful if your project headers are different from and longer than the TOC captions, which is inserted with <%TOPIC_TITLE%>.

This is used primarily for search engine optimization, for which you would insert it in the description meta tag, like this:

<meta name="description" content="<%TOPIC_HEADER_TEXT%>">

<%TOPIC_TEXT%>

Inserts the body text of a topic, i.e. the entire topic as edited and formatted in your project in the Help & Manual editor. This is the most important variable  – if you leave it out your topics will be empty!

<%TOPIC_BREADCRUMBS%>

Generates a series of "breadcrumb trail" navigation links to topics above the current topic in the TOC tree. This variable is empty in top-level topics. In second-level topics and below the variable generates a series of links in the format Link1 > Link2 > Link3 ...

The current topic is not included in the series. If you want to place the current topic title at the end of the breadcrumb trail you can do so with the <%TOPIC_TITLE%> variable (see below).

The breadcrumb trail variable is empty in topics in the Invisible Topics section.

This variable has a matching condition pair: <IF_TOPIC_BREADCRUMBS> and <IFNOT_TOPIC_BREADCRUMBS>. These conditions can be used to only insert the trail where it is relevant and to insert alternative content when it is not relevant.

See here for details on how to use this variable.

<%TOPIC_TITLE_PATH%>

This variable is similar to the breadcrumbs variable above but it delivers the breadcrumb trail as a plain text string without any links. Unlike the breadcrumbs variable it also includes the name of the current topic, so it always delivers a full trail.

 

The primary use of this variable is for search engine optimization, for which you would insert it in the <title> tag of your topic page template instead of the normal <%TOPIC_TITLE%> variable, like this:

<title><%TOPIC_TITLE_PATH%></title>

 

Modification for HTML Help:

If you also output to HTML Help you should use conditional text to ensure that this variable is only used in Browser Help, otherwise you will get the full path as the topic name in your search results in the HTML Help viewer. Do it like this:

<title><IF_HTML><%TOPIC_TITLE_PATH%></IF_HTML><IF_CHM><%TOPIC_TITLE%></IF_CHM></title>

<%TOPIC_HEADER_BGCOLOR%>

HTML-encoded color string triplet that represents the background color of the topic header, if one has been set.

<%TOPIC_TEXT_BGCOLOR%>

HTML-encoded color string triplet that represents the body background of the topic.

<%TOPIC_TITLE%>

Topic title (this is the caption of the topic in the TOC).

<%TOPICID%>

Returns the plain topic ID as written in the Topic ID: field of Topic Options, without any filename  extension and without changing the ID text to lower case. This can be used to add an ID reference in your meta attributes in your web pages, for example:

<meta name="id" content="<%TOPICID%>" />

<%TOPIC_KEYWORDS%>

Inserts all the keywords of the current topic, comma-separated. Needless to say, this variable is essential for the keyword index and shouldn't be removed...

<%TOPIC_AKEYWORDS%>

Inserts all the A-keywords of the current topic, comma-separated.

<%HREF_PREVIOUS_PAGE%>

Link address of the previous topic (used for Previous/Next buttons).

<%HREF_NEXT_PAGE%>

Link address of the next topic.

<%HREF_DEFAULT_PAGE%>

Link address of the "Default" topic. This is used for the standard Top navigation link in the topic headers so that users can return to the default topic in your project.

<%HREF_PARENT_CHAPTER%>

Link address of the parent topic (chapter). This can be used as an alternative to <%HREF_DEFAULT_PAGE%>.

If the parent is a chapter without text, this is the link address of the parent's parent. If no valid parent is available, the variable is the link address of the default page.

<%HREF_CURRENT_PAGE%>

Link address of the current page.

 

All the <%HREF variables insert the local names of the corresponding pages within the current directory without any path information, e.g. topic1name.htm, topic2name.htm and so on.

 

Variables for use in Browser-based Help only:

All the remaining variables are only relevant in Browser-based Help (HTML):

Global variables for all Browser-based Help templates:

Variable

Content and/or function of the variable

 

 

<%HREF_TOP_PAGE%>

Link address of the top frame (e.g. "index.html")

<%HREF_CONTENT_PAGE%>

Link address of the TOC page

<%HREF_INDEX_PAGE%>

Link address of the keyword index-page

<%HREF_SEARCH_PAGE%>

Link address of the full-text search page

Variables for the Layout frameset template only:

Variable

Content and/or function of the variable

 

 

<%HREF_CONTENT_PAGE_DYN%>

Link address of the dynamic TOC page.

<%HREF_CONTENT_PAGE_STATIC%>

Link address of the static TOC page.

<%NAVIGATION_SCRIPT%>

Inserts the navigation script required by the top frame.

Variables for the Table of Contents template only:

Variable

Content and/or function of the variable

 

 

<%TABLE_OF_CONTENTS%>

Inserts the entire TOC in the page.

 

Variables for the Keyword Index template only:

Variable

Content and/or function of the variable

 

 

<%KEYWORD_INDEX%>

Inserts the entire keyword index in the page.

 

Variables for the Full-text Search template only:

Variable

Content and/or function of the variable

 

 

<%SEARCH_SCRIPT%>

Inserts the full-text search script in the page.

See also:

Using HTML Templates

Editing HTML templates

Help Windows

 


Page url: http://www.helpandmanual.com/help/index.html?hm_ref_variables_html.htm