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

grunt-blog

v0.1.5

Published

A grunt plugin to organize content and generate indexes for Memba Mini Blog Engine.

Downloads

3

Readme

grunt-blog

A grunt plugin to organize markdown content and generate indexes for Memba Mini Blog Engine.

NPM

Overview

This plugin works as a component of Memba Mini Blog Engine. It performs 3 tasks:

  1. Analysing and updating the markdown in all the md files located in the news directory,
  2. Copying the new updated files in a chronological hierarchy under the posts directory,
  3. Indexing these files in the form of an RSS file at the root of the posts directory.

Getting Started

This plugin requires Grunt ~0.4.2

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-blog --save-dev

Once the plugin has been installed, it may be enabled inside your project's Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-blog');

and configured by adding a section named blog to the data object passed into grunt.initConfig().

grunt.initConfig({
  blog: {
    options: {
      //
      //Web site options
      home: '...',
      route: '...',
      index: '...',
      sitemap: '...',
      //
      //File options
      homeRoot: '...'
      newsRoot: '...',
      postsRoot: '...',
      //
      //RSS options
      category: '...',
      copyright: '...',
      description: '...',
      docs: '...',
      generator: '...',
      image: '...',
      language: '...',
      lastBuildDate: '...',
      link: '...',
      managingEditor: '...',
      pubDate: '...',
      rating: '...',
      title: '...',
      ttl: '...',
      webMaster: '...'
    },
    your_target: {
      // Target-specific options go here.
    },
  },
});

The "blog" task configuration

Web site options

options.home

Type: String Default value: 'http://miniblog.memba.com'

The home of your blog where index.html can be reached.

options.route

Type: String Default value: '#/blog/'

The route .

options.index

Type: String Default value: 'index.rss'

The file name of the RSS index located in options.postsRoot. Unless you dig into the code of Memba Mini Blog Engine, we recommend keeping the default value.

options.sitemap

Type: String Default value: 'sitemap.xml'

The file name of the XML sitemap located in options.homeRoot. Unless you dig into the code of Memba Mini Blog Engine, we recommend keeping the default value.

File options

options.homeRoot

Type: String Default value: ''

Location of index.html.

This is the portion of options.newsRoot and options.postsRoot that we should remove to build relative paths to display media files.

options.newsRoot

Type: String Default value: 'news'

The directory containing the new md files which should be added as posts to the blog.

An md file is a text file with:

  1. the *.md extension,
  2. meta data in the form key:value\n at the top
  3. [markdown] (http://daringfireball.net/projects/markdown/) at the bottom separated from the meta data by \n\n

Note: \n is a line feed

For example:

title: my title
description: my description

Some markdown here

options.postsRoot

Type: String Default value: 'posts'

The directory of published md files and media files organized chronologically by grunt-blog.

RSS Options

For more information:

See http://cyber.law.harvard.edu/rss/rss.html See http://www.w3schools.com/rss/rss_channel.asp.

options.category

Type: String Default value: 'Web Development'

The category the RSS channel belongs to. Also used as a default category for items.

See http://www.w3schools.com/rss/rss_tag_category_channel.asp See http://www.w3schools.com/rss/rss_tag_category_item.asp

Note: There can only be one category at this stage.

options.copyright

Type: String Default value: 'Copyright (c) 2013-2014 Memba. All rights reserved.'

Notice of copyrighted material.

See http://www.w3schools.com/rss/rss_tag_copyright.asp

options.description

Type: String Default value: 'A static blog engine which displays live markdown content (What You Write Is What You Publish).'

A description for the channel, used as a default description for items.

See http://www.w3schools.com/rss/rss_tag_title_link_description_channel.asp See http://www.w3schools.com/rss/rss_tag_title_link_description_item.asp

options.docs

Type: String Default value: 'http://cyber.law.harvard.edu/rss/'

URL to the documentation of the format used in the RSS feed.

See http://www.w3schools.com/rss/rss_tag_docs.asp

options.generator

Type: String Default value: 'http://miniblog.memba.com'

Program used to generate the RSS feed.

See http://www.w3schools.com/rss/rss_tag_generator.asp

options.image

Type: String Default value: 'http://miniblog.memba.com/styles/images/logo.png'

Image to display when aggregators present a feed.

See http://www.w3schools.com/rss/rss_tag_image.asp

options.language

Type: String Default value: 'en-US'

The language the channel is written in.

See http://www.w3schools.com/rss/rss_tag_language.asp

options.lastBuildDate

Type: Date Default value: new Date().toISOString()

Last modified-date for the content in the RSS feed.

See http://www.w3schools.com/rss/rss_tag_lastbuilddate.asp

options.link

Type: String Default value: 'http://miniblog.memba.com/posts/index.rss'

A link to the channel.

See http://www.w3schools.com/rss/rss_tag_title_link_description_channel.asp See http://www.w3schools.com/rss/rss_tag_title_link_description_item.asp

options.managingEditor

Type: String Default value: 'Memba'

E-mail address for the editor of the content of the feed, also used as default for item authors.

http://www.w3schools.com/rss/rss_tag_managingeditor.asp

options.pubDate

Type: Date Default value: new Date().toISOString()

Last publication date for the content in the RSS feed.

See: http://www.w3schools.com/rss/rss_tag_pubdate.asp

options.rating

Type: String Default value: undefined

The PICS rating of the feed.

See: http://www.tutorialspoint.com/rss/pics-ratings.htm

options.title

Type: String Default value: 'Memba Mini Blog Engine'

A title for the channel.

See http://www.w3schools.com/rss/rss_tag_title_link_description_channel.asp See http://www.w3schools.com/rss/rss_tag_title_link_description_item.asp

options.ttl

Type: Number Default value: 1440

The (ttl=time to live) element specifies the number of minutes the feed can stay cached before refreshing it from the source.

See http://www.w3schools.com/rss/rss_tag_ttl.asp

options.webMaster

Type: String Default value: 'Memba'

E-mail address to the webmaster of the feed.

See http://www.w3schools.com/rss/rss_tag_webmaster.asp

Usage Example

In this example, we show you the typical configuration you should be considering in your project.

grunt.initConfig({
  blog: {
    options: {
          home: 'http://yoursite/index.html', //The path to your Mini Blog Engine
          newsRoot: 'news', //your news directory
          postsRoot: 'posts', //your posts directory
          title: 'Your title for your RSS channel',
          link: 'http://yoursite',
          description: 'Your description for your RSS channel',
          copyright: 'Copyright (c) 2013-2014 You. All rights reserved.',
          category: 'Web Development', //The default category for your blog posts
          managingEditor: 'The default author for your blog posts',
    }
  },
});

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

v0.1.2 First functional release (more testing/polishing/documenting required though) v0.1.3 Documentation and image processing completed (more on the way though)