npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

simple-blog

v1.5.1

Published

A simple, session-free and extendable blogging platform.

Downloads

7

Readme

SimpleBlog

A simple blogging platform built on Node.js and Express.js that uses Markdown syntax for posting.

To speed things up, Simple doesn't make use of user sessions. Since there are no sessions, there is no admin user. Simple makes all admin pages (new post, edit, etc) accessible to the public but requires a master password to do anything serious.

Demo: My blog

Installation

npm install simple-blog

Enviroment Setup

Your app will need access to a MongoDb database to save posts. You can do one of the following:

  • Have MongoDb installed locally on port 27017
  • Set environment variable MONGO_URL to a remote location (ex. MongoHQ)

You can also set the password you will use to create/edit posts by setting the environment variable BLOG_SECRET. The password is only required if NODE_ENV is set to production and will default to "password" if not specified.

Sample Server

require('simple-blog').start();

Server With Custom Views And Stuff

Simple Uses Express.js for a backend so setup is very simple.

Copy template and public directories

Simple comes with a default template but I'm sure you'll want to make your own. To make sure you have everything you need to get started you can copy the sample files from the module by doing the following:

$ cd myApp/
$ cp -r node_modules/simple-blog/public ./
$ cp -r node_modules/simple-blog/views ./

Point Simple To The Layout Files

To prevent Simple from using it's sample files, call the setup() function in your main app script.

var simple = require('simple-blog');

// ALL PARAMETERS ARE OPTIONAL
simple.setup({
  name: 'Test Blog', // Blog Title

  // How to generate slugs (defaults to "title")
  slugType: 'base36', // options: "title" | "base36"

  // Path to the root of your app
  rootDir: __dirname,

  // Specify a URL that will dump all data
  //   Leave out or set to FALSE to disable
  dumpPath: '/dump',

  // Set amount of posts per page (defaults to 3)
  pageSize: 5,

  // Path to Express.js directories
  publicPath: '/public',
  viewPath: '/views',

  // Redirect www.domain... to domain...
  redirectWWW: true,

  /*************************************************
   * The rest is used for the RSS feed
   */

  // Disable RSS
  // rss: false,

  // Enable RSS at /rss.xml (defaults to disabled)
  rss: {
    description: 'A test blog to showcase simple-blog',
    author: 'Gregory Schier',
    img: '/favicon.ico', // Feed image
    limit: 10 // Feed item cutoff
  }
});

// Add custom routes the same as you would with Express.js
simple.app.get('/about', function(req, res) {
  res.render('about', { title: 'About' });
});

// Add event listeners. Options are 'comment', 'start'

simple.events.on('comment', function(comment) {
  console.log('COMMENT', comment)
});

simple.events.on('start', function(config) {
  console.log('START', config);
});


// Start Simple Blog
simple.start();

User Guide

Since Simple doesn't use sessions it doesn't know who the admin is. To keep people from finding the admin pages they are only accessable by direct url. Here is what you need to know:

// Admin stuff
New post      /new
edit post     /edit/post/<POST SLUG>

// General stuff
Home             /
Pagination       /?p=1
View Post        /post/<POST SLUG>
View Tag         /tag/<TAG>
Drafts           /drafts
Recent Comments  /comments
JSON Dump Posts  /dump

Screenshots

This is the default template

Simple Blog