All Projects → chrisallenlane → wit-cms

chrisallenlane / wit-cms

Licence: MIT License
A flat-file, markdown-based, blog-aware content-management system for Express.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to wit-cms

Verless
A simple and lightweight Static Site Generator.
Stars: ✭ 276 (+922.22%)
Mutual labels:  blog-engine, content-management-system
Hugo
The world’s fastest framework for building websites.
Stars: ✭ 55,899 (+206933.33%)
Mutual labels:  blog-engine, content-management-system
Zola
A fast static site generator in a single binary with everything built-in. https://www.getzola.org
Stars: ✭ 7,823 (+28874.07%)
Mutual labels:  blog-engine, content-management-system
acblog
An open source extensible static & dynamic blog system. (an alternative tool with same features at StardustDL/paperead)
Stars: ✭ 60 (+122.22%)
Mutual labels:  blog-engine, content-management-system
Netcorecms
NetCoreCMS is a modular theme supported Content Management System developed using ASP.Net Core 2.0 MVC. Which is also usable as web application framework. This project is still under development. Please do not use before it's first release.
Stars: ✭ 165 (+511.11%)
Mutual labels:  blog-engine, content-management-system
RooCMS
RooCMS - This is easy and convenient content management system designed to quickly create websites.
Stars: ✭ 21 (-22.22%)
Mutual labels:  blog-engine, content-management-system
minimal
Website and blog generator for Go, Node.js or Python
Stars: ✭ 94 (+248.15%)
Mutual labels:  blog-engine
sweetroll2
A powerful micro/blogging engine with IndieWeb features (abandoned)
Stars: ✭ 27 (+0%)
Mutual labels:  blog-engine
flute
The Application Framework Built for Powerful, Secure features and add-ons
Stars: ✭ 14 (-48.15%)
Mutual labels:  content-management-system
lara-s-cms
A PHP Laravel Skeleton for CMS/Admin Dashboard (within/without website)
Stars: ✭ 28 (+3.7%)
Mutual labels:  content-management-system
api-server
📡 API server for api.cdnjs.com - The #1 free and open source CDN built to make life easier for developers.
Stars: ✭ 48 (+77.78%)
Mutual labels:  express-js
simple-blog-engine-for-asp-net-core
A simple blog engine for ASP.NET Core developers.
Stars: ✭ 15 (-44.44%)
Mutual labels:  blog-engine
spica
Spica is a development engine to build fast & efficient applications.
Stars: ✭ 77 (+185.19%)
Mutual labels:  content-management-system
nera
A lightweight static site generator
Stars: ✭ 12 (-55.56%)
Mutual labels:  blog-engine
smallblog
Flat file markdown blogging system with filesystem watch and extended markdown support
Stars: ✭ 23 (-14.81%)
Mutual labels:  blog-engine
magixcms
Magix cms est un gestionnaire de contenu développé en PHP 5, proposant une multitude d'outils intégrés. Le gestionnaire est simple et intuitif permettant une adaptation rapide pour tout utilisateur, ainsi qu'une indexation optimal dans les moteurs de recherches.
Stars: ✭ 16 (-40.74%)
Mutual labels:  content-management-system
express-mvc-generator
Express' Model View Controller Application Generator.
Stars: ✭ 46 (+70.37%)
Mutual labels:  express-js
flatboard
A very Fast & Lightweight Flat-file forum software, Markdown and BBcode editor.
Stars: ✭ 30 (+11.11%)
Mutual labels:  blog-engine
getmein-web
Portal to get an invite to IIITV GitHub organization
Stars: ✭ 26 (-3.7%)
Mutual labels:  express-js
Whatsapp-Botto-Void
A fully Object Oriented WhatsApp bot built with TypeScript
Stars: ✭ 64 (+137.04%)
Mutual labels:  express-js

Build Status npm npm

wit-cms

wit-cms is a flat-file, "blog aware", publishing platform for Express. It's designed for those who want WordPress-like functionality without the heft and attack-surface of a WordPress installation. It emphasizes simplicity, security, and performance.

Overview

Page and post content is declared by creating markdown files within the appropriate directories. wit-cms will generate everything else automatically, including:

  • express routes (both sync and async)
  • a "home" page
  • "pages" and "posts" (with "read more" links and pagination)
  • "tag" and "category" taxonomies
  • blog search and archive
  • a sitemap.xml
  • an RSS feed
  • syntax-highlighting on all content via highlight.js.

On application start, wit-cms loads all site content into an in-memory object, making it possible to serve content without reading a disk. This makes it faster than traditional database-backed content-management systems.

wit-cms seeks to offer a compromise between the full-featuredness of WordPress and the ultra-minimalism of Jekyll, and strives to be a viable alternative to those who may be dissatisfied with either.

Quick Start

To install only the wit-cms module, run:

npm install wit-cms

To spare yourself the tedium of having to write boilerplate templating, however, it may be preferable to clone the wit-cms-bootstrap repository and modify from there. This is the recommended approach for using wit-cms:

https://github.com/chrisallenlane/wit-cms-bootstrap

Creating Content

In order to create a "post" (a blog entry) or a "page" (content that exists outside of the blog context), simply create a markdown file of the appropriate name, and in the appropriate location. By default, markdown files that source page content live in <webroot>/pages/, and markdown files that source blog posts live in <webroot>/posts/.

Page and post urls will be generated based off of the filename of the corresponding markdown file. For example, the source markdown for a "Hello World" blog post should be saved to <webroot>/posts/hello-world.md, and its URL would be /blog/post/hello-world.

Front-matter

As with Jekyll, wit reads page and post metadata (title, date, author, categories, tags, etc.) out of front-matter embedded within each post or page via the json-front-matter module.

For example, all posts should contain a header like the following:

{{{
"title"       : "Hello World (of node blogging)",
"description" : "The post description."
"author"      : "John Doe",
"categories"  : [ "node", "blogging" ],
"tags"        : [ "javascript", "express" ],
"date"        : "2012-09-15"
}}}

Pages will have a similar, but sparser, header:

{{{
"title"       : "About Me",
"description" : "The page description."
"url"         : /about-me,
"searchable"  : true
}}}

The url property provides a mechanism to specify the URL at which the page should be published. This parameter is optional, and defaults to the name of the corresponding markdown file. (Example: about-me.md will publish by default to /about-me.)

The searchable property provides a mechanism for excluding pages from appearing in search results. The searchable parameter is optional, and defaults to true.

Beyond the above, any additional properties specified in front-matter will be made available to the corresponding rendered views as page locals.

Routes

wit-cms automatically generates the following routes:

Synchronous

  • /
  • /:page
  • /page/search
  • /blog/
  • /blog/post/:name
  • /blog/category/:category
  • /blog/tag/:tag
  • /blog/archive/:year/:month?/:day?
  • /blog/search
  • /search
  • /feed
  • /feed.xml
  • /sitemap.xml

Asynchronous

  • /async/pages
  • /async/pages/search
  • /async/pages/:page
  • /async/blog/
  • /async/blog/post/:name
  • /async/blog/category/:category
  • /async/blog/tag/:tag
  • /async/blog/archive/:year/:month?/:day?
  • /async/blog/search
  • /async/tags
  • /async/categories
  • /async/params

The asyncronous routes return JSON responses.

Objects

wit-cms buffers all site content in a wit object. Here is an example of its structure:

wit {
  pages: {
    "about"     : aPageObject,
    "contact"   : aPageObject,
    "portfolio" : aPageObject,
  },

  posts: {
    "website-redesign" : aPostObject,
    "blogging-in-node" : aPostObject,
    "wit-vs-wordpress" : aPostObject,
  },

  tags: [
    'the-first-tag',
    'the-second-tag',
    'the-third-tag',
    'etc',
  ],

  categories: [
    'the-first-category',
    'the-second-category',
    'the-third-category',
    'etc',
  ],

  index: {
    page: aLunrIndex,
    post: aLunrIndex,
  },

  params: {
    // arbitrary params specified on initialization
  },

}

Whereby a post object takes the following shape:

 {
  title      : 'The Post Name',
  name       : 'the-post-name',
  url        : '/blog/post/the-post-name',
  author     : 'John Doe',
  categories : [ 'foo', 'bar' ],
  tags       : [ 'alpha', 'bravo', 'charlie' ],
  date: {
    datetime : '2012-09-12T00:00:00-04:00',
    day      : '02',
    month    : '04',
    pretty   : '2 April 2014', // configurable
    unix     : '1396411200',
    year     : '2014',
  excerpt: '<p>Content before the break.</p>',
  content: '<p>The page content.</p>',
}

And a page object takes the following shape:

 {
  title       : 'The Page Name',
  name        : 'the-page-name',
  url         : '/the-page-name',
  author      : 'John Doe',
  description : 'A descripton for the page.',
  content     : '<p>The full page content.</p>'
}

Initializing

The wit-cms module will export a single function that will decorate an initialized Express app. Upon invokation, the function will also return a wit object that contains the entirety of the wit data.

const express = require('express');
const path    = require('path');
const Wit     = require('wit-cms');
var app       = express();

// express configs
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

// wit configs
var config = {

  // template params
  params: {
    author  : 'John Doe',
    fqdn    : 'https://example.com',
    name    : 'Example Website',
    tagLine : 'An example site made using wit-cms',
  },

  // 302 redirect '/' to this page
  pages: {
    home: '/about-me'
  },
  
};

// initialize the wit instance
const wit = Wit(app, config);

Note that arbitrary properties may be attached to config.params. These properties will be made available to page templates via the returned wit object as wit.params.

Searching

wit-cms provides for searching among pages and blog posts via the lunr module.

Commenting

Because wit-cms stores its content in flat files instead of a database, it does not and can not natively support a reader commeting system. If you'd like to enable commenting on your blog, consider using Disqus or isso.

Security

wit-cms neither implements administrative access controls, nor requires a database back-end. As such, it is immune to many classes of attacks to which other content-management systems may be vulnerable.

It is not "hack proof", however. Its attack-surface consists (at least) of:

  1. Inputs that write to the DOM (search boxes, URLs, etc.)
  2. The attack-surface of Express
  3. The attack-surface of nodejs

As a defense against Cross-Site Scripting attacks, wit-cms internally relies on the xss module to sanitize user inputs that may be written back to the DOM. Regardless, it is still prudent to use a templating engine (ejs, hogan, etc.) when authoring views.

Lastly - though this should go without saying - the node application should never be run as root.

Upgrading

[email protected] is backwards-incompatible with prior versions. See the wiki for upgrading instructions.

License

wit-cms is released under the MIT license. See LICENSE.txt for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].