Blog archives
In PieCrust, there are two ways to show a list of blog posts, or somehow manipulate the blog posts in bulk:
The first way is to use the pagination features, exposed through the
paginationtemplate variable. This will however (unsurprisingly) trigger pagination on the current page (i.e. create sub-pages of the current page that can be accessed with “next entries”/”previous entries“-type of links). That can be stopped with thesingle_pageconfiguration setting, but the list of posts will still be, by default, limited and filtered according to the default pagination settings.The other way is to use the more straightforward blog archives.
Blog archive variables are accessed through the blog template variable,
unless you have more than one blog defined. In that case, there will be
one blog archive per blog, each named after each blog. This means that if your
blogs are defined as artblog and cookingblog, those will be the names of
the template variables through which you access the archives. In the rest of
this page we will be referring to the main case of a blog variable, however.
List of posts
You can get an unlimited and unfiltered list of blog posts with blog.posts.
This is a post iterator object, which has cool stuff like count,
skip(n), limit(n) or filter(filtername).
Again, the main difference between this and tweaking the
pagination.postslist to your liking is that the pagination one will create sub-pages — usingblog.postswill not.
You can also access the list of tags and categories with blog.tags and
blog.categories. Each entry in those arrays will be rendered as the name of
the tag or category, but they also have a few properties of their own:
name: the name of the tag or category (for convenience/readability).posts: the list of posts in that tag or category. This is also, again, a post iterator.
Yearly and monthly archives
To make writing blog archives easier, the blog variable also exposes posts
split by year or month. They are available in blog.years and blog.months.
Each entry in those arrays will be rendered as the name of the year or month
(e.g. 2011 or 2012 01), but they also have a few properties of their own:
name: the name of the year or month (for convenience/readability).timestamp: the timestamp of the year or month, so you can pass it through a custom date format.posts: the posts in that year or month. This is also, again, a post iterator.