Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 95 lines (51 sloc) 6.377 kB
d746325 @olegp added README
authored
1 # MCMS
2
a79769d @olegp added ringo setup instruction to readme
authored
3 MCMS is a fast Minimal CMS written in server side JavaScript. It uses only the file system and as such runs without a database. [Mustache](http://mustache.github.com/) is used for defining the templates and [GitHub flavored Markdown](https://github.com/isaacs/github-flavored-markdown) for the pages. It includes support for creating a list of links to all pages, making it possible to use it as a simple blog.
0ff19bc @olegp readme updated
authored
4
6d2aea4 @olegp Update README.md
authored
5 By being built on top of the [CommonJS](http://commonjs.org) [Filesystem/A](http://wiki.commonjs.org/wiki/Filesystem/A) and [JSGI 0.3](http://wiki.commonjs.org/wiki/JSGI/Level0/A/Draft2) specs, it runs on multiple server side JavaScript platforms, such as Node.js (via [Common Node](http://olegp.github.com/common-node/)) and [RingoJS](http://ringojs.org) (and as a result runs on Google's AppEngine and other Java hosting platforms).
0ff19bc @olegp readme updated
authored
6
7 ### Usage
8
a79769d @olegp added ringo setup instruction to readme
authored
9 #### Node
10
11 Install MCMS with `npm install mcms`. Also make sure that you have [Common Node](https://github.com/olegp/common-node/#readme) installed as a global package (via `npm install -g common-node`). Run `common-node node_modules/mcms` to start the server.
12
13 #### RingoJS
14
15 Install the Markdown package with `ringo-admin install https://github.com/isaacs/giub-flavored-markdown/zipball/master`.
16
17 Install MCMS with `git clone git://github.com/olegp/mcms.git`, then `cd mcms` and start the server with `ringo ./lib/mcms.js`.
18
19 #### Viewing a Site
20
e285fba @olegp added note on caching to readme
authored
21 Once the server is running, open [http://localhost:8080](http://localhost:8080) with your browser - you should see the contents of this README. Note that by default MCMS caches the generated HTML in memory, so if you update the template or pages, you will need to restart your server.
a79769d @olegp added ringo setup instruction to readme
authored
22
23 #### Creating a Site
0ff19bc @olegp readme updated
authored
24
25 The easiest way to get started with a new site is to clone an already existing one and modify it to get the site you want (TODO: add link to repo). Alternatively, if you're starting from scratch you can also create a directory for your site. Inside it, add a single file named `index.js` with the following line:
26
d99cdb4 @olegp updated readme
authored
27 exports.app = require('mcms').app;
0ff19bc @olegp readme updated
authored
28
29 In the same directory, create the following sub-directories:
30
31 * `static` - Contains our static resources such as JavaScript served to the browser and CSS
32 * `templates` - For the page templates - usually just one called `index.html`. Templates are defined using HTML and Mustache.
33 * `pages` - For the actual pages in Markdown format, e.g. `index.md`.
34
5cffd15 @olegp readme updated
authored
35 For an example, take a look at the source for this package - the MCMS project itself includes the same directories that make up a site that serves this README file.
0ff19bc @olegp readme updated
authored
36
37 ### Features
38
44fa968 @olegp 404 section added
authored
39 ### Custom Page Titles
40
41 The name of the file in the `./pages` directory becomes the page title, and is accessible via `{{title}}` inside templates.
42
43 ### SEO friendly URLs
44
45 The name of the file is converted to an SEO friendly format which involves:
46
47 * converting all characters to lower case
48 * converting all spaces to hyphers (-)
49 * removing all non alpha, digit characters, hyphers or forward slashes
50 * removing all occurrences of more than one hyphen & leading/trailing hyphens
51
52 So, for example `Really Long & Weird Example!` becomes `really-long-weird-example`.
53
54 This SEO friendly URL is then used to access the given page. To get a list of all the page titles and URLs, see the "List of Pages" section below.
55
56 #### Page Sub-directories
57
d6ae59a @olegp added note on blog post links to readme
authored
58 It is possible to place pages in sub-directories. For example a page in the file `./pages/hello/world.md` is accessible at `/hello/world`.
44fa968 @olegp 404 section added
authored
59
60 #### Custom Templates
61
62 By default, every page uses the `templates/index.html` template. It is possible to override this template on a per page basis by creating a template with a name that matches that of the page, e.g. a page at `./pages/custom.md` can have a custom template provided via `./templates/custom.html`.
63
64 #### Includes
65
66 It is possible to include reusable blocks of HTML across different templates by placing `.html` or `.md` files in the optional `./includes` directory. For example an include `./includes/footer.html` can be included via `{{{footer}}}` (triple mustaches are needed to ensure that the HTML is not escaped). Markdown (.md) files are automatically converted to HTML.
67
68 #### List of Pages
69
c1d9b4c @olegp added # to ascending array
authored
70 It is possible to get a list of all the pages on the site via the `{{#ascending}}` array. For example, this renders a bunch of links to all the pages:
44fa968 @olegp 404 section added
authored
71
c1d9b4c @olegp added # to ascending array
authored
72 {{#ascending}} <a href="{{link}}">{{title}}</a> {{/ascending}}
d6ae59a @olegp added note on blog post links to readme
authored
73
c1d9b4c @olegp added # to ascending array
authored
74 The pages above are listed in an ascending lexicographic order. To get them in reverse use `{{#descending}}`. If you have a list of blog posts which you would like to list in reverse chronological order, you can add an additional prefix used for sorting to the file name, e.g. `20101010|First post!.md` and use descending order to display a list of posts in reverse chronological order. Everything up to and including the `|` separator is used for sorting, but ignored when constructing page titles.
44fa968 @olegp 404 section added
authored
75
76 #### Custom Error Pages
77
78 It is possible to provide custom pages for HTTP file not found (404) errors. Simply create a file `./pages/404.md`.
0ff19bc @olegp readme updated
authored
79
d99cdb4 @olegp updated readme
authored
80 ### Acknowledgements
81
82 * [Jan Lehnardt](http://github.com/janl/) for the CommonJS implementation of Mustache
83 * [Isaac Schlueter](http://github.com/isaacs/) for the `github-flavored-markdown` package
84
0ff19bc @olegp readme updated
authored
85 ### License
86
87 (The MIT License)
88
89 Copyright (c) 2011+ Oleg Podsechin
90
54ea4d6 @olegp wrapping fixed in license
authored
91 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
92
93 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
94
95 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.