Trash bin GitHub logo Information Right arrow Staticman title Staticman

Home / Documentation /

Configuration file

The configuration file for Staticman should be in the root of the repository and named staticman.yml (unless you’re using a v1 endpoint, in which case you should name it _config.yml and consider upgrading). The following parameters are accepted.

The values of some parameters need to be protected from the public eye, so they’re encrypted with a public key associated with the Staticman API instance — these are flagged with the RSA encrypted field string.

Click here to access the public key for the public Staticman instance.

allowedFields

An array with the names of the allowed fields. If any of the fields sent is not part of this list, the entry will be discarded and an error will be thrown.

Example:

allowedFields: ["name", "email", "message"]

Default:

[]

akismet.enabled

Whether to use Akismet to check entries for spam. This requires an Akismet account to be configured in the Staticman API instance being used.

Default:

false

akismet.author

Name of the field to be used as the entry’s author in Akistmet

Default:

""

akismet.authorEmail

Name of the field to be used as the entry’s author’s email in Akistmet

Default:

""

akismet.authorUrl

Name of the field to be used as the entry’s author’s URL in Akistmet

Default:

""

akismet.content

Name of the field to be used as the entry’s body in Akistmet

Default:

""

akismet.type

Type of entry to be sent to Akismet

Default:

"comment"

branch

Name of the branch being used within the GitHub repository.

Default:

"master"

commitMessage

Text to be used as the commit message when pushing entries to the GitHub repository.

Default:

"Add Staticman data"

extension

The extension to be used in the generated data files (defaults to the extension associated with the format field)

Default:

""

filename

Name for the data files being uploaded to the repository. You can use placeholders (denoted by curly braces), which will be dynamically replaced with the content of a field (e.g. {fields.name}), the content of an option (e.g. {options.slug}) or other dynamic placeholders such as the entry’s unique id ({@id}).

Default:

""

format

Format of the data files being uploaded to the repository.

Possible values:

  • yaml
  • yml
  • json
  • frontmatter

Default:

"yml"

generatedFields

List of fields to be appended to entries automatically. It consists of an object where keys correspond to the names of the fields being created and values being of mixed type. If values are objects, Staticman will look for a type and options keys inside and perform different operations based on their type; otherwise, the value will be used directly as the content of the generated field.

Example:

generatedFields:
  someField: "some string" # Simple field (string)
  date: # Extended field (date)
    type: date
    options:
      format: "timestamp-seconds"

moderation

When set to true, a pull request with the data files will be created to allow site administrators to approve or reject an entry. Otherwise, entries will be pushed to branch immediately.

Default:

true

name

Human-friendly name of the property/website. This is used in notification emails.

Example:

name: "My awesome blog"

Default:

""

notifications.enabled

Whether email notifications are enabled. This allows users to subscribe to future comments on a thread. A Mailgun account is required.

Default:

false

path

Path to the directory where entry files are stored. You can use placeholders (denoted by curly braces), which will be dynamically replaced with the content of a field (e.g. {fields.name}), the content of an option (e.g. {options.slug}) or other dynamic placeholders such as the entry’s unique id ({@id}).

Default:

"_data/results/{@timestamp}"

pullRequestBody

Text to be used as the pull request body when pushing moderated entries.

Default:

"Dear human,\n\nHere's a new entry for your approval. :tada:\n\nMerge the pull request to accept it, or close it to send it away.\n\n:heart: Your friend [Staticman](https://staticman.net) :muscle:\n\n---\n"

requiredFields

An array with the names of the fields that must be supplies as part of an entry. If any of these is not present, the entry will be discarded and an error will be thrown.

Default:

[]

transforms

List of transformations to be applied to any of the fields supplied. It consists of an object where keys correspond to the names of the fields being transformed. The value determines the type of transformation being applied.

Example:

transforms:
  email: "md5" # The email field will be MD5-hashed

reCaptcha.enabled

Set to true to force reCAPTCHA validation, set to false to accept comments without reCAPTCHA.

Default:

false

reCaptcha.secret

🔐 RSA encrypted field

Encrypted Secret for your reCAPTCHA site registration

Default:

""