webCOMAND

Publications

A publication is used to produce a set of related files, such as the files that make up a:

  • Website - HTML, CSS, JavaScript, Images and other supporting multi-media files.
  • Documentation - Similar to a website, but typically organized and structured differently.
  • App - Software application files, such as JavaScript and/or PHP and their support files.

A publication is composed from the following key components.

  • Publication Procedure - Produces a single file or collection of similar files, based on a "template".
  • Publication - Defines the Publication Procedures to publish, the content and settings their templates will use, and the destination for the produced files.

Publication Procedure

A Publication Procedure is a content record that defines the file name and content of one or more files.

  • Filename - The filename determines where the file(s) this publication procedure produces will be written, relative to the Publication's base Publish Path.  It can be a simple filename like "example.html" or include a path like "css/web.css".
  • Script - The contents of the file(s) are produced by a Script, which can output text or binary data.

cTemplate

The Filename and Script are processed as cTemplate, which means they can reference variables and directives and expressions to programmatically produce the results based on Global Variables, Publication Lists and Repository Content.

Global Variables

System Variables can be referenced to insert information about the system into the filename or content, such as the $SystemDate.  Those variables can be manipulated or formatted with directives like #FORMAT.

Publication Variables can be referenced to insert information about the publication into the filename or content, such as ${Publication.PublishPath} or any custom defined Publication Settings, such as ${Publication.Color}.

For a complete list, see cTemplate Global Variables.

Publication List

A single Publication Procedure may produce multiple files by leveraging a Publication List.  A Publication List is another content record used to define a query that will produce a list of content records.  When a Publication Procedure specifies a Publication List, the Filename and Script will be processed for each content record in the Publication List.  The Filename and Script can reference the content record and its fields as cTemplate variables.  The content record can be referenced with the variable $this.  The field values can be referenced by variables named after each field's Identifier.  For example, the "Name" field can be referenced as $Name.

Repository Content

cTemplate Content Directives can be used to insert content records and their field values into the file name and content.  Content available to a Publication Procedure can be restricted by the Publication.

Example

All of these options make it possible to produce just about any content you can imagine.  For example, the following Publication Procedure will produce a web page for each Student content record.

  • List: Students
  • Filename:
    student/#REGEXREPLACE(/[^A-Za-z0-9]/, '', $Name)-$OID.html
  • Script:
    <html>
    <head>
        <title>$Name</title>
    </head>
    <body>
        <h1>$Name</h1>
        <img src="#INSERT('photo.jpg', $Photo)" />
        <ul>
            <li><strong>DOB:</strong> #FORMAT($DOB, '%m/%d/%Y')</li>
            <li><strong>Address:</strong> $Address</li> 
        </ul>
        <p>Published #FORMAT($SystemDate, '%B %e, %Y').</p>
    </body>
    </html>

Publication

A Publication is a content record that defines what Publication Procedures to publish, where to publish them and additional settings that can be utilized by the Publication Procedures.

For details, see Publication Content Type.

Publication Settings

In addition to the base fields discussed above, which are defined in the Publication content type, custom Publication Settings can be defined by extending the Publication content type and adding any fields to make available to the Publication Procedures as Global Variables.

For more information, see Publication Framework.

Publication Instances

Any number of content records of the Publication content type or ones that extend it can be defined to create variations of a publication, each with their own publish destinations, content sources, Publication Settings, etc.  This is useful not only for creating distinct publications, but also for creating different versions of a single publication, such as a production and staging version.

Publication Dependencies

In order to improve publish performance, dependencies can be enabled to record information about content referenced by a Publication Procedure as it is processed, and the resulting output.  That information can then be used by subsequent Publication Procedures, Publication List iterations and full publishes to avoid unnecessary publishing when the dependent content hasn't changed since the last publish, and to reuse shared component output.

For information about enabling dependencies, see Dependencies Configuration.