Reference

This section provides some reference information related to the default metadata of contents and assets, as well as the full documentation of the hastysite min Module.

Default Content and Asset Metadata

The following table lists all the default metadata properties available for contents and assets, and also after which build phase they become available.

Note

You can define your own custom metadata for contents in a header section delimited by five dashes, at the start of each content file.

Property Content Asset
id
path
ext
type
title ^1
content-type ^1
date ^(1,2)
timestamp ^(1,2)
contents ^3 ^3
  • 1 This property is defined for all page and post contents created using the default page and post commands.
  • 2 This property is defined for all post contents created using the default post command.
  • 3 This property must be added to contents and assets before they can be written to the output folder. This can be done implicitly using symbols provided with the hastysite min module.

hastysite min Module

This min module can be imported in the rules.min file or in any script file and can be used to perform common operations such as ready and writing files, and interact with HastySite data at build time.

assets

(meta*)

Returns a quotation of metadata dictionaries (meta*) containing the metadata of each asset file.

clean-output

Deletes all the contents of the output directory.

clean-temp

Deletes all the contents of the temp directory.

contents

(meta*)

Returns a quotation of metadata dictionaries (meta*) containing the metadata of each content file.

input-fread

meta string

Reads the contents of the file identified by the metadata dictionary meta (such as those returned by the contents and assets parameters).

Note that:

markdown

string1 dict string2

Converts the HastyScribe Markdown string string1 into the HTML fragment string2, using the properties of dict as custom fields (accessible therefore via HastyScribe’s {{$<field-name>}} syntax).

mustache

string1 dict string2

Renders mustache template string1 into string2, using dictionary dict as context.

Note

string1 is the path to the mustache template file, relative to the templates directory and without .mustache.

output

string

Returns the full path to the output directory.

output-cp

meta

Copies a file from the source directory (contents or assets depending on its type) to the output directory.

Note that:

output-fwrite

meta

Writes the contents of the file identified by the metadata dictionary meta (such as those returned by the contents and assets parameters).

Note that:

postprocess

Starts the postprocessing phase of the build.

preprocess

Starts the preprocessing phase of the build.

preprocess-css

string1 string2

Pre-process CSS contents within string1, i.e.:

  1. Pseudo-SCSS partial imports. Partial CSS files must start with an underscore and be placed in the css-partials directory (set in your settings.json, or assets/styles if not specified).
  2. CSS variable declarations

Returns the resulting CSS code string2.

For example, the following CSS code in two different files:

_vars.css:
:root {
   --standard-gray: #cccccc;
}
style.css:
@import 'vars';
.note {
  background-color: var(--standard-gray);  
}

Will be converted into the following:

:root {
  --standard-gray: #cccccc;
}

.note {
  background-color: #cccccc;  
}

Limitation

Only basic support for CSS variables is provided, e.g. no fallback values are supported.

process-rules

Starts the processing phase of the build, and interprets the rules.min file.

settings

dict

Returns a dictionary dict containing all the settings defined in the settings.json file.