Class: Config

CMS.Config(optionsopt)

Configuration handler for the CMS

Constructor

new Config(optionsopt)

Parameters:
Name Type Attributes Default Description
options Object <optional>
null

Pass an Object to autoload site-specific options

Source:

Members

dateParser :RegExp

Parsing regular expression for parsing a date from a File URL

Type:
  • RegExp
Source:

debug :boolean

Set to true to enable debug logging, (will enable logging events to the console)

Type:
  • boolean
Source:

defaultView :string

The URL that will be the default view that will initially load (sans the .html extension)

For example, to use '/posts.html' as the homepage, set to 'posts'. To use '/pages/home.html', set as 'pages/home'.

Type:
  • string
Source:

elementId :string

ID of element to attach MarkdownMaster CMS to

Type:
  • string
Source:

extension :string

Extension to match Files with

Type:
  • string
Source:

frontMatterSeperator :string

Separator for FrontMatter content in Markdown files

Type:
  • string
Source:

layoutDirectory :string

Name of the layouts directory on the filesystem

Type:
  • string
Source:

markdownEngine :function|null

Markdown engine to use for parsing into HTML

Type:
  • function | null
Source:

messageClassName :string

Class to add to system messages (when in debug mode)

Type:
  • string
Source:

titleSearchResults :string

Page title to set when searching for content

Type:
  • string
Source:

types :Array.<ConfigType>

Types of file collections available on the CMS

Type:
  • Array.<ConfigType>
Source:

webpath :string

This is set to the web path to use for URLs. For example, if your site is located in https://domain.tld/cms/ your web path should be '/cms/'

Type:
  • string
Source:

Methods

addType(name, layout)

Add a new file type to the CMS

Parameters:
Name Type Description
name string

Name of the type, must match directory name

layout Object

Layout configuration and defaults

Properties
Name Type Description
list string

Template file to use for listing this content type

single string

Template file to use for rendering a single page

sort string

Default sort for files when browsing the listing page

title string

Page title set when browsing the listing page

Source:

dateFormat(date)

Function to call when rendering dates to the page, useful for modifying how dates display

Parameters:
Name Type Description
date Date

Common option parameters:

  • weekday - The representation of the weekday. Possible values are:

    • "long" (e.g., Thursday)
    • "short" (e.g., Thu)
    • "narrow" (e.g., T). Two weekdays may have the same narrow style for some locales (e.g. Tuesday's narrow style is also T).
    • key ommitted, weekday is not displayed at all
  • year - The representation of the year. Possible values are:

    • "numeric" (e.g., 2012)
    • "2-digit" (e.g., 12)
  • month - The representation of the month. Possible values are:

    • "numeric" (e.g., 3)
    • "2-digit" (e.g., 03)
    • "long" (e.g., March)
    • "short" (e.g., Mar)
    • "narrow" (e.g., M). Two months may have the same narrow style for some locales (e.g. May's narrow style is also M).
  • day - The representation of the day. Possible values are:

    • "numeric" (e.g., 1)
    • "2-digit" (e.g., 01)

For more information about date options, refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options

Source:

extra(name, key, defaultValue) → {mixed}

Get a plugin / extra configuration value

Parameters:
Name Type Description
name string

Name of the plugin

key string

Key to fetch from the plugin

defaultValue mixed

Default value if not set

Source:
Returns:
Type
mixed

load(options)

Load a user-defined dictionary of configuration values to override the defaults (usually set from the site config.js)

Parameters:
Name Type Description
options Object
Source: