Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Latest
method default.prototype.slug
import { default } from "https://deno.land/x/netlify_cms_config@v0.3.2/collections/folder.ts";

The slug option specifies a template for generating new filenames based on a file's creation date and title field. (This means that all collections with create: true must have a title field (a different field can be used via identifier_field). The slug template can also reference a field value by name, eg. {{title}}. If a field name conflicts with a built in template tag name - for example, if you have a field named slug, and would like to reference that field via {{slug}}, you can do so by adding the explicit fields. prefix, eg. {{fields.slug}}. Available template tags:

Any field can be referenced by wrapping the field name in double curly braces, eg. {{author}} {{slug}}: a url-safe version of the title field (or identifier field) for the file {{year}}: 4-digit year of the file creation date {{month}}: 2-digit month of the file creation date {{day}}: 2-digit day of the month of the file creation date {{hour}}: 2-digit hour of the file creation date {{minute}}: 2-digit minute of the file creation date {{second}}: 2-digit second of the file creation date

Parameters

slug: string