Code Monkey home page Code Monkey logo

blogdown's Introduction

blogdown

blogdown is a lightweight blog engine written in Node.js that serves static markdown articles.

Setup

See install instructions for Node.js at nodejs.org. You will also need Express and EJS (use node package manager)

$ npm install express
$ npm install ejs

Start the server by running the following command.

$ node server.js

Usage

By default, server.js will parse markdown articles (.md extension) located in /articles. All articles need to start with a line of the following format (each attribute separated by a double pipe):

Article Title||Author||Date||Published
// Example:
Test Article #1||Mikael Bjorkstam||04/24/2011||true
// The following article will be ignored
Some Article in Progress||Mikael Bjorkstam||04/24/2011||false

Attributes

  • Article title
  • A slug will be generated based on this title
  • Author
  • Date
  • will be parsed into a JavaScript Date object
  • Published
  • boolean => true or false

Only articles with the published flag set to true will be loaded. Once an article has been loaded, showdown.js is used to parse the markdown into html.

blogdown comes with prettify by default, which syntax highlights code blocks.

Static files are served under /public

Benefits

The benefit of blogdown is that once the server has started, all the files are parsed and stored in memory. There is no database needed, nor will the server access the filesystem on every request.

Should you wish to reload the articles from the filesystem, you can do so by accessing /api/refresh/?key=API_KEY. The following example will re-parse all articles:

curl http://localhost:8080/api/refresh/?key=demo

Note that in order for any changes to an article to take effect, the articles must be re-parsed.

Issues

Right now, the error handling isn't working 100% properly (the 404 page is not rendered as intended)

blogdown's People

Contributors

bjorkstam avatar

Stargazers

 avatar Morgan Craft avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.