Using variables to assign file names on the web


You can use a variable in the Filename field located on the Web tab of a topic's Properties, and the variable will be resolved during publishing. The Filename field is used when publishing to HTML-based outputs such as HTML and XHTML pages, Web Help, HTML Help, JavaHelp, and Oracle Help.


Suppose you use the < SYS_HEADING> variable to name individual files using the topic heading when publishing to HTML pages. (When the Filename field is not used, the file created during publishing is named using the topic's object code.)

Variable in Filename Field on Web Tab

  • You can add the variable to individual topics, or you can add the variable to the topic template (and update all topics in the publishing job that are based on that template).
  • During publishing the variable is resolved and the topic's filename is created using the topic heading. When you open the publishing folder you'll see that instead of naming the published file using the object code (for example, 1026.htm) the file is named using the topic's heading (for example, Introduction.htm).
  • If the heading includes spaces, during publishing the spaces are removed for the filename (so the topic heading X1000 Specifications creates the filename X1000Specifications.htm).

    Important: If the variable cannot be resolved during publishing, the variable name is used as the Filename, and the angle brackets are replaced with underscores in the published files. If multiple topics use the variable, the files will all be named using the variable name (with a number appended to the variable name).

    For example, if there is an error in the variable name and the variable is not resolved, you might see something like _SYS_HEADNG_.htm, _SYS_HEADNG__2.htm, _SYS_HEADNG__3.htm, and so on.