Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-notebook

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-notebook

A drop-in markdown blogging framework for Express applications that takes 60 seconds to set up.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

express-notebook

A simple, drop-in markdown blogging framework for Express applications.

  • Write blog posts in markdown.
  • Template-engine-agnostic.
  • Simple setup and configuration.
  • Drops into existing applications.

Installation

$ yarn add express-notebook

or

$ npm install express-notebook --save

Usage

  1. Register express-notebook with your application.
const Notebook = require('express-notebook');

const notebook = new Notebook({
  // Your Express app object.
  app,

  /**
   * The directory in your project where you'll keep your post markdown files and `data.json`
   * (explained below).
   */
  postsDir: 'src/posts',

  // The URL path prefix where your posts will be accessed (eg example.com/posts/foo-bar).
  urlPath: '/posts',

  /**
   * The template with which your posts will be rendered. Should render a `post` variable that's
   * rendered unescaped since `post` will be an HTML string.
   */
  template: 'post'
});

notebook.setPostRoutes();
  1. Create a directory for your posts somewhere in your project. In this directory, add a file called data.json with your post data like this:

eg, src/posts/data.json

{
  "posts": [{

    // The name of the markdown file corresponding to this post. This markdown file should live in the same directory as data.json
    "filename": "foo.md",

    // The URL slug for this post.
    "slug": "my-blog-post",

    // Any metadata want to pass to your post template.
    "metadata": {
      "title": "My blog post title",
      "date": "3/14/2017",
      "location": "San Francisco, California"
    }
  }, {
    ...
  }]
}

express-notebook also exposes the post data read from data.json. This is useful for creating a post index, for example.

...
const posts = notebook.getPostData();

res.render('/posts', {
  posts
});
...

Changelog

  • 1.0.1 Bump version for publishing via npm instead of Yarn (see https://github.com/yarnpkg/yarn/issues/1619)
  • 1.0.0 Initial release

FAQs

Package last updated on 23 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc