Next: , Previous: , Up: Builders   [Contents][Index]


5.4.3 Blog

(use-modules (haunt builder blog))
Procedure: theme [#:name "Untitled"] [#:layout] [#:post-template] [#:collection-template] [#:pagination-template]

Create a new theme named name.

The procedure layout accepts three arguments: a site, a page title string, and an SXML tree. Its purpose is to wrap the contents of a post with the theme’s header/footer and return the complete SXML tree for a web page.

The procedure post-template accepts a single argument: a post. Its purpose is to return an SXML tree containing the contents of the post, applying any desired post-processing operations.

The procedure collection-template accepts four arguments: a site, a title string, a list of posts, and a URL prefix string. Its purpose is to return an SXML tree containing the body of the collection page.

The procedure pagination-template accepts four arguments: a site, an SXML tree, the file name of the previous page, and the file name of the next page. Its purpose is to incorporate the given SXML tree into a larger document that incorporates previous/next page links.

Procedure: theme? object

Return #t if object is a theme object.

Procedure: blog [#:theme] [#:prefix] [#:post-prefix] [#:collections `(("Recent Posts" "index.html" ,posts/reverse-chronological))] [#:posts-per-page]

Create a builder procedure that transforms a list of posts into pages decorated by theme, a theme object, whose URLs start with prefix. Post pages may be nested deeper in the file hierarchy than collection pages by specifying the post-prefix argument.

Additionally, this builder creates pages that aggregate previews of many posts corresponding to what is specified in the list collections. Each collection is a three element list in the form (title file-name filter).

title

The human readable name of the collection.

file-name

The HTML file that will contain the rendered collection.

filter

A procedure that accepts a list of posts as its only argument and returns a new list of posts. The filter procedure is used to remove and/or sort the posts into the desired form for the collection. For example, a filter could sort posts in reverse chronological order or select all posts that are written by a particular author.

By default, a single collection is created that lists posts in reverse chronological order and writes to index.html.

Also by default, collection pages are not paginated. When there are a lot of posts in one or more collections, it is best to paginate them. To do so, pass the posts-per-page argument.

The default theme is intended only for testing purposes.


Next: Atom, Previous: Flat pages, Up: Builders   [Contents][Index]