A Dynamic Title

This is a sample Document.Factory document containing a Liquid Template that generates a Markdown document that is then rendered into HTML.

File Content

The first line of this file is a header that specifies the kind of information contained in the file - in this case, the reserved word liquid specifies that this contains a liquid template for processing.

This header has a title property with the value {{ name }}. The value for name is provided on the commandline - see the associated dfcmd.ps1 file for details.

How it Works

  1. A value for the property name is passed on the command line, along with the name of the file to process.

  2. The file is loaded into a single fragment as a liquid template

    The YAML part (containing the values title and outputType) is parsed into data for the template to use. Everything following the first --- line is treated as simple text.

    As the YAML part is processed, the value A Dynamic Title for the property title is evaluated, replaced with the value from the command line.

  3. The Liquid templating engine runs and generates a markdown output fragment.

    When the markdown fragment is created from the output of the liquid template engine, the values from the YAML header are available.

  4. The Markdown engine runs and generates an output HTML fragment

  5. The HTML fragment is written to an output file

The key is that values defined on the command line are available for use within the YAML header of the liquid template itself.