Reference‎ > ‎

Placeholders

Template, section and content file placeholders

Placeholders are commands in a document that will be replaced with some content in build process. All placeholders have similar look: they are arranged as html special characters and preceded by a dot, like &.root;. See an example template and find some placeholders in it:

<html>
<head>
<title>&.site-title; | &.title;</title>
<link rel="stylesheet" href="&.root;common.css" />
</head>

<body>
<h1>&.title;</h1>

<p class="topmenu">&.section(topmenu);</p>
<p class="submenu">&.section(submenu);</p>

&.text;

</body>
</html>

The following placeholders may appear in your templates, section and content files:

&.dir-name;

the name of current directory where source file resides (relative to the site root). In site root it's empty, in /folder1/folder2/index.html it's folder1/folder2/.

See also:     .top-dir-name, .root placeholders.

&.file-body;

name of file without extension (index for index.html).

See also:     .file-ext, .file-name placeholders.

&.file-ext;

name of resulting file extension (.html for index.html).

See also:     .file-body, .file-name placeholders.

&.file-name;

name of resulting file including extension (index.html).

See also:     .file-body, .file-ext placeholders.

&.root;

string with a number of concatenated ../ substrings needed to access a site root from a content file in any subfolder. Used to maintain paths in HTML tags (like IMG SRC or A HREF). For a file in site root value is empty, in /folder1/folder2/folder3/index.html it's ../../../.

Example:     we need to use the same stylesheet on every page. The file common.css is placed in folder css/ under site root. In the HEAD section of template we put a <link rel="stylesheet" href="&.root;css/common.css" /> directive, where HREF parameter becomes href="css/common.css" in /index.html and transforms to href="../../css/common.css" in /folder1/folder2/index.html.

See also:     .dir-name, .top-dir-name placeholders.

&.section(section-name);

a placeholder to show where the content of section section-name will be put. If current directory contains file named _section-name.cfg (where prefix _ and postfix .cfg may be changed) its contents is inserted, otherwise the text &.section(section-name); is shown to notify you about a missing file.

Example:     template file contains directives &.text; and &.section(top-menu);. Source folder /About/ contains index.src file which is a content file (replaces the &.text; placeholder) and _top-menu.cfg file which will be used as a section contents (replaces the &.section(top-menu); placeholder). Destination /About/ folder will contain index.html file with both placeholders resolved. If folder /Jobs/ only contains content files and _top-menu.cfg is not listed then all destination .html files in corresponding folder will show &.section(top-menu); string in place of its contents.

See also:     Content file structure and commands for a way to change sections on per-file basis.

&.site-title;

the site title defined in config.xml file. May be used in template HEAD section between TITLE tags to insert a site name on each page.

See also:     Config file tags.

&.text;

a main placeholder, shows a place in template where text from a content file will be inserted. Actually, all text from a file except the first line which is used as a container for titles and commands.

See also:     Content file structure and commands.

&.title;

this placeholder indicates the page title taken from a first line of a content file. Used to appear between the TITLE tags. Before replacing this placeholder the 4 basic special characters in this title are converted into HTML entities (those are: &, ", <, >) so that for example a <Welcome to Alpha & Beta> title becomes &lt;Welcome to Alpha &amp; Beta&gt; in your page.

See also:     .title(n) placeholder, Content file structure and commands.

&.title(n);

.title(n) placeholder identifies one of the titles from a first line of content file (where they are separated by tabs). n starts with 0. Titles are inserted as a pure HTML without any special chars replacements. Except this fact .title(0) is identical to .title.

See also:     .title placeholder, Content file structure and commands.

&.top-dir-name;

the name of top-level directory of the source file subtree. If file is in site root the value is empty, in first level subdirectory /folder1/index.html it's the folder name (folder1), in any subfolder /folder1/folder2/folder3/index.html it's still folder1.

See also:     .dir-name, .root placeholders.

&.ver;

if ver-file is defined in config.xml file, this placeholder is replaced with the truncated version string (before the last dot that separates the incremented part). For example, Version 3.1.0.371 version string translates into Version 3.1.0 to replace .ver.

See also:     .version placeholder, ver-file in Config file tags.

&.version;

if ver-file is defined in config.xml file, this placeholder is replaced with the string from the version file.

See also:     .ver placeholder, ver-file in Config file tags.

Comments