Skip to content

Commit

Permalink
Updated Readme and added js documentation comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alasdair Stalker committed Mar 4, 2013
1 parent f57d38c commit 2960bf8
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 8 deletions.
18 changes: 12 additions & 6 deletions README.md
@@ -1,4 +1,3 @@

# NBLOG

Simple Blog CMS using Mongoose, Express and EJS.
Expand Down Expand Up @@ -32,14 +31,21 @@ Add the following to your main script and specify your login details for the Adm
}
nblog.init(params);

The public path is relative to the module so to use a public dir in the root you would specify /../../../public
Nblog requires Mongo DB so make sure to start it before running your App.
The dev and prod values are the environments. These can be configured via Node Environment variables so you can specify different settings for your local and production sites.

## Features

* Add, edit and delete articles
* Articles displayed in a blog layout with links to each article
* Urls built based on date and alias
* Add, edit and delete articles. Meta content included for some basic SEO.
* Articles displayed in a blog layout with links to each article.
* Article urls automatically built based on date and the alias.
* Add, edit and delete content pages.
* Additional content pages displayed in the main nav.
* Google sitemap generation.
* Twitter Bootstrap implemented.

## Requirements

MongoDB is required and should be running before starting Nblog.

## License

Expand Down
22 changes: 22 additions & 0 deletions lib/helper.js
Expand Up @@ -2,18 +2,40 @@ var db = require('./mongoose')
, Crypto = require('crypto')
, logmongo = require('logmongo');

/**
* Create an md5 hash.
*
* @param {String} String to create the hash from
* @param {Function} callback function
* @api public
*/
exports.md5 = function(str, callback){
var hash = Crypto.createHash('md5');
hash.update(str, 'utf-8');
callback(hash.digest('hex'));
}

/**
* Create a Gravatar url.
*
* @param {String} the email address to use as the basis for the Gravatar
* @param {Function} callback function
* @api public
*/
exports.gravatar = function(email, callback){
exports.md5(email, function(hash){
callback('http://www.gravatar.com/avatar/' + hash + '?s=40');
});
};

/**
* Get application preferences specified in the object params and from the database. The last login date is also returned if requested.
*
* @param {String} String to create the hash from
* @param {Function} callback function
* @param {Boolean} get the last login date
* @api public
*/
exports.prefs = function(params, callback, getlog){
db.projectPreferences(params, function(err, prefs, pages){
if (prefs.gravatar){
Expand Down

0 comments on commit 2960bf8

Please sign in to comment.