Constructor
new Config(optionsopt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options |
Object |
<optional> |
null | Pass an Object to autoload site-specific options |
- Source:
Members
container :null|HTMLElement
Container for rendering content in the CMS
Type:
- null | HTMLElement
- Source:
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:
loadingContainer :null|HTMLElement
Container for loading hint in the CMS
Type:
- null | HTMLElement
- Source:
markdownEngine :Object|null
Raw markdown engine to use for parsing into HTML
Type:
- Object | null
- Source:
markdownParser :function|null
Parsing function to use for rendering Markdown into HTML
Type:
- function | null
- Source:
messageClassName :string
Class to add to system messages (when in debug mode)
Type:
- string
- Source:
serviceWorker :boolean|string
Controls if the service worker is loaded into this application
If set to a non-empty string, is expected to be the path to the service worker. If set to True, the default service worker is used. If set to False or an empty string, no service worker is enabled.
Type:
- boolean | string
- Source:
tasklistChecked :string|null
Icon to use for task list items that are checked, ([x])
Set to NULL to disable this feature and just render plain text or 'input' to render as an input checkbox
Type:
- string | null
- Source:
tasklistUnchecked :string|null
Icon to use for task list items that are checked, ([ ])
Set to NULL to disable this feature and just render plain text or 'input' to render as an input checkbox
Type:
- string | null
- 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:
version :string
Asset version, useful for cache busting
Type:
- string
- 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
|
- Source:
addTypes(types)
Add multiple types at once
Parameters:
| Name | Type | Description |
|---|---|---|
types |
- Source:
dateFormat(date)
Function to call when rendering dates to the page, useful for modifying how dates display
Parameters:
| Name | Type | Description |
|---|---|---|
date |
Date | null | Common option parameters:
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
getTypeLayout(type) → {ConfigTypeLayout}
Get the type layout for the given type.
Either single or list name can be provided, eg: 'page' or 'pages'.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string |
- Source:
Returns:
- Type
- ConfigTypeLayout
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: