webgen logo

webgen / static website generator

static website generation made easy!

Latest news

2007-09-08: Small bug fix release. More...

2007-06-29: Some bug fixes and one small feature enhancement. More...

2007-05-20: Fixed bug which prevented installation via Rubygems. More...

Links

Generated by webgen

Page Menu

General Information

Plugin name:Tag/News (Tag/Default)
Author:Jeremy Hinegardner
Summary:Process a news file and format it on a page.
Parameters:

contentFormat"textile"
The markup format for the content.

contentTagnil
The HTML tag to surround the content entry.

dateFormat"%Y-%m-%d"
The format of the date for the entry.

dateTag"h2"
The HTML tag to surround the date.

filename (=default mandatory parameter): "news.yaml"
The name of the news file, relative to website root

options{}
Options passed to the plugin which formats the news.

Handled tags:news

Description

This plugin creates a ‘news’ tag which can be used to display the contents of a news file.

The news file by default is ‘news.yaml’ and placed in the root of the webgen website directory. This can be changed with the ‘filename’ parameter.

The yaml file has the basic format of

date: content
date: content

Where the date has the format indicated by the ‘dateFormat’ parmater which by default is YYYY-MM-DD. The content is formated according to the ‘contentFormat’ parameter and is textile by default. I recommend using the ’|’ version of block text for the content. For example:

  2007-03-20: |
      h2. this is an entry

      This is some content

When utilized in a template the ‘news’ tag can optionally take to additional parameters ‘maxEntries’ and ‘maxParagraphs’.

  • maxEntries: the N most recent entries by date in the news.yaml file to display.
  • maxParagraphs: the content of an entry is truncated to N paragraphs, where a paragraphs ending is defined by ”\n\n”

So the following usage of the news tag would disply the first paragraph of the most recent item in the news.yaml file.

{news: {options: {maxEntries: 1, maxParagraphs: 1}}}

While this usage would display all the contents of the news.yaml file sorted in reverse chronological order and displayed fully.

{news: }