HTML template variables

<< Click to Display Table of Contents >>

Navigation:  Reference > Modules, Conditional Output & Variables > Variables and Conditional Output >

HTML template variables

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, WebHelp, Windows Exe and ePUB eBooks and Visual Studio Help).

Variable

Content and/or function of the variable

Note on HREF-Variables:

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.

<%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.

<%DOCTYPE%>

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

You can insert your own <DOCTYPE> declaration in the template explicitly and if you do this no error message will be displayed. However, it may produce unexpected results.

<%GAACCOUNT%>

Filled with the value specified for the for your Google Analytics account (i.e. your GA account identifier).

<%HREF_CURRENT_PAGE%>

Link address of the current page.

<%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_NEXT_PAGE%>

Link address of the next topic.

<%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_PREVIOUS_PAGE%>

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

<%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_AKEYWORDS%>

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

<%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 Date & time formatting in variables 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_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_DESCRIPTION%>
<%TOPICMETA:DESCRIPTION%>

Inserts the text from the Description field in the topic's Topic Options tab if you have entered a description there. Otherwise it inserts the first 177 characters of the topic text, followed by an ellipsis (...).

This can be used in combination with the "featured image" (see next row) to insert a "title" image and a description for your topic in your template.

In addition to this it can also be used to populate the description meta tag for search engines like this:

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

<%TOPICMETA:PICTURE%>
<%TOPIC_PICTURE%>

Returns the file name of the "featured image" for the current topic, if one has been set in the topic's Topic Options. Returns blank if no featured image has been set.

<%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_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_TITLE%>

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

Important:
Don't confuse this with the global <\%TOPICTITLE%> variable (without an underscore) for use in the topic editor.

<%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>

<%TOPICID%>

Returns the plain topic ID as written in the Topic ID: field of , 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%>" />

(This variable can also be used in normal topic pages.)

<%XMLLANG%>

Returns the project language code, e.g. en-us for US English.

Variables for use in WebHelp only:

All the remaining variables are only relevant in WebHelp (HTML):

Variables for WebHelp 3 mode only:

In WebHelp 3 mode, the JavaScript files, graphics and video files and CSS files are all saved in sub-folders of the main WebHelp folder. You can use these variables in your HTML templates to automatically insert the relative paths to these folders.

Variable

Content and/or function of the variable

<%HM_RELPATH_JAVASCRIPT%>

Returns the relative path to the JavaScript files folder:

./js/

<%HM_RELPATH_IMAGES%>

Returns the relative path to the images and media files folder (video files are also stored here):

./images/

<%HM_RELPATH_CSS%>

Returns the relative path to the CSS files folder:

./css/

Global variables for all WebHelp templates:

Variable

Content and/or function of the variable

<%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

<%HREF_TOP_PAGE%>

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

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 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 Variables

Using HTML Templates

Editing HTML templates

Help Windows