kapowcms v0.1.4
KapowCMS
Very simple cms tool with admin and static generated html files stored in Redis.
Fast, safe, simple!
Prerequisite
- Node
- Redis installed and running
Install
Create a new npm project and add kapowcms as a dependency:
$ npm init
$ npm install kapowcms --save
Then copy database file (you can then open it and edit if you'd like):
$ cp node_modules/kapowcms/db.example.json db.json
Create file index.js with content:
global.appRoot = __dirname;
const kapowcms = require('kapowcms');
kapowcms.run();
Port
You can also set what port to run KapowCMS from by giving it as a parameter to the run method. Default is 3000.
kapowcms.run([], 3000);
Run
$ node index.js
Plugins
Add plugin by adding it as a npm dependency, for example:
$ npm install kapowcms-disqus --save
And then add it to the array in the run method in your index.js:
global.appRoot = __dirname;
const kapowcms = require('kapowcms');
kapowcms.run([
require('kapowcms-disqus')
]);
Create new theme
- Copy /node_modules/kapowcms/themes/default to /themes/xxx
- Update theme in db.json
- Go to admin and save some post to regenerate all posts
Examples
For every template option you can check /node_modules/kapowcms/themes/example
Templates
Every template not starting with an underscore in it's filename will be available as a template for posts. Every template will by default have a title and a content field.
You can set template settings if you create a .json file with the same name as the template. The following options are available:
{
"name": "Just an image",
"fields": [
{
"id": "image",
"name": "Image",
"type": "image"
},
{
"id": "imagecaption",
"name": "Image Caption",
"type": "text"
},
{
"id": "select",
"name": "Select",
"type": "select",
"options": [
{ "id": "option1", "name": "Option 1" },
{ "id": "option2", "name": "Option 2" }
]
},
{
"id": "selectmultiple",
"name": "Select Multiple",
"type": "selectmultiple",
"options": [
{ "id": "option1", "name": "Option 1" },
{ "id": "option2", "name": "Option 2" }
],
"defaultSelected": "all"
}
],
"exclude": [ "content" ]
}
name
The name of the template
fields
Array of custom fields for the template. Every field takes the following options:
id
Id of field
name
Name of field
type
Type of field. The following types are currently supported:
- text
- image
- select
- multipleselect
exclude
Array of fields to exclude