Trash bin GitHub logo Information Right arrow Staticman title Staticman

Home / Documentation /

Site configuration file

The site configuration file for Staticman should be in the root of the repository hosting the static website and named staticman.yml (in the now deprecated v1 this file was named _config.yml). The following parameters are accepted.

See the sample site config file for an example.

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. See the Encryption section for further details.

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:

[]

allowedOrigins

When allowedOrigins is defined, only requests sent from one of the listed domains will be accepted.

Example:

allowedOrigins: ["localhost", "eduardoboucas.com"]

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 Akismet

Default:

""

akismet.authorEmail

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

Default:

""

akismet.authorUrl

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

Default:

""

akismet.content

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

Default:

""

akismet.type

Type of entry to be sent to Akismet

Default:

"comment"

auth

Whether (oauth) authentication is required for an entry to be accepted

Default:

"false"

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"

githubAuth.clientId

🔐 RSA encrypted field

The client ID to the GitHub Application used for GitHub oauth authentication.

githubAuth.clientSecret

🔐 RSA encrypted field

The client secret to the GitHub Application used for GitHub oauth authentication.

githubAuth.required

(DEPRECATED: Use auth.required instead.) Whether authentication is required for an entry to be accepted.

Default:

false

gitlabAuth.clientId

🔐 RSA encrypted field

The client ID to the GitLab Application used for GitLab oauth authentication.

gitlabAuth.clientSecret

🔐 RSA encrypted field

The client secret to the GitLab Application used for GitLab oauth authentication.

Base URL for the OneDev API.

Default:

"https://code.onedev.io/api"

Username for the OneDev API.

Default:

""

Password or Access Token for the OneDev API.

Default:

""

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:

""