Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

poet-for-express-4

alexbirkett80MIT1.1.2

quick and easy blog module, using markdown, jade, whatever

blog, blogging, markdown, jade, posts, writing

readme

Poet for Express 4 Build Status

Deprecated fork

jsantell/poet 2.0 supports Express 4 redering this fork obsolete

This is a fork of jsantell/poet that supports Express 4. Express 3 and below are not supported by this fork.

Looking for maintenance help!

Poet has your code-blogging back. Renders markdown, jade, or any templated files as posts, tag it up with metadata that's passed into any view engine you want, instant pagination, tag and category views, and home in time for dinner.

View the source for jsantell.com to see an example of Poet in use. Much <3 to Brittany Fedor for the sweet art!

The Node Poet

New Release

v1.1.0

Changes in v1.1.0

Documentation

Full documentation for Poet can be found at http://jsantell.github.io/poet

Poet In Action

These sites are using Poet for their blogging, check them out! Ping me, or send a PR if you too are using Poet in the wild.

Installing

  • npm install poet

Setup

Include Poet in your package.json and add it to your app, passing in your Express app and options. Call the init method and routes will be set up!

var
  express = require('express'),
  app = express(),
  Poet = require('poet-for-express-4');

var poet = Poet(app, {
  posts: './_posts/',
  postsPerPage: 5,
  metaFormat: 'json'
});

poet.init().then(function () {
  // ready to go!
});

/* set up the rest of the express app */

Development

To run tests, run npm test from the project root to run the Mocha tests. Generate documentation by updating the docs.md and running make.

Contributing

Please read the CONTRIBUTING.md for guides on contributions.

License

MIT License, Copyright (c) 2012 Jordan Santell

changelog

Change Log

v1.1.0

v1.0.0

  • Fixed some issues with allow Express 4.0.0+ in tests and examples 2816f43a68e04714bf28a838cb618e7cf5517a68, 57eba690d1a4e1b07a1d1c2b6fbb82e7c062cdca
  • Render helpful errors in posts that have template errors, and hide posts with template errors in production, issue #82
  • Expose additional properties to template functions, issue #81
  • Add method unwatch to remove all current watchers, issue #68

v1.0.0-rc4

  • :warning: The routes configuration option during instantiation will no longer create routes that are not explicitly defined, unless using defaults, issue #71
    • Leaving routes as empty will continue to use the default routing.
    • Setting routes to null will not set any routes.
    • Setting routes to an object will only define routes specified in that object. Therefore, using an empty object will not set any routes.
  • :warning: Post slugs are now created from the title attribute instead of the file name. Slugs can also be customized by adding a slug attribute in a post, issue #64, issue #69
  • Bake version of marked and json-front-matter to be consistent with previous versions -- can include newer versions with custom templating.
  • Handles errors more gracefully when posts cannot compile with their template, issue #61

v1.0.0-rc3

  • Added async templating processing, issue #50
  • Fixed hiding drafts in helper functions, issue #54, issue #48
  • Option showFuture to hide posts scheduled for the future, issue #47

v1.0.0-rc2

  • Added a 'next()' fallback for the auto page route, issue #45
  • Allow users to specify their own options to be included in poet.options, issue #37,
  • Fixed an issue where calling addRoute with an invalid route misbehaves, issue #38

v1.0.0rc1

Check out the examples directory for updated uses of the changes.

  • require('poet') now returns a constructor (new is not needed). The constructor takes an Express app argument and an options argument. All methods are now performed on the resulting instance, rather than the global Poet object.
  • Auto updating now possible! The watch method has been added to auto update poet on any post change.
  • init method now returns a promise for the completion of the reinitialization. It also still accepts a callback.
  • set has been removed -- options are passed in during instantiation.
  • All route creation methods (createPostRoute, createPageRoute, createTagRoute, createCategoryRoute) have been removed and created on instantiation. The routes option in configuration may be used instead.
  • addRoute method has been added to define a custom route.
  • middleware has been removed. This can be achieved by using the instance's helper properties which contain all the previous helpers/locals.
  • Several locals/helpers have been renamed:
    • pageUrl is now pageURL
    • tagUrl is now tagURL
    • categoryUrl is now categoryURL
    • sortedPostsWithCategory is now postsWithCategory
    • sortedPostsWithTag is now postsWithTag
  • Several helpers have been removed and turned into functions
    • postList can now be retrieved via getPosts()
    • tagList can now be retrieved via getTags()
    • categoryList can now be retrieved via getCategories()