Creating a blog post
Creating a blog post is a lot like creating a page, only you create the
text file in the
posts folder instead of
There are 3 ways of organizing the
hierarchical. By default PieCrust uses the
flat mode. You can change the
mode in the site configuration using the
flat mode, all blog posts are HTML files in the
posts folder that follow
this naming convention:
Here’s an example:
posts |- 2010-08-23_why-i-love-bacon.html
By default, that article would be accessible at
http://domain.com/2010/08/23/why-i-love-bacon, although you can also change
the URL format of blog posts in the site configuration.
This organization is good for blogs that don’t have a lot of updates.
shallow mode, the
posts folder has sub-folders for each year, and those
have all the posts for that year using the following convention:
posts |- 2010 |- 08-23_why-i-love-bacon.html
This organization is good for blogs with only a couple updates per month.
hierarchical mode, the year and month of a blog post are specified by the
sub-folders in which they reside:
posts |- 2010 |- 08 |- 23_why-i-love-bacon.html
This organization is good for blogs with quite a lot of articles.
When a page displays a list of blog posts, you sometimes don’t want to put the complete posts texts in there — instead, you only want the introduction of the post to be used. You can “cut” a post in two by inserting one of the “page break” tags:
<!-- more --> <!-- break --> <!-- pagebreak -->
Any of these tags would tell the pagination system to only take whatever comes before that tag when a post is shown in a list. See the pagination documentation for more info.
In addition to the usual page configuration values, blog posts can define a few useful things:
time: Use this to specify a time of day for when the post was written (e.g. “12:45:02”). PieCrust will use it to expose the correct
timestampvariables to the template engine.
tags: Use this to add tags to a post, so that it appears in tag listings. This should be an array, like so:
tags: [ food, cooking, fun ].
category: Use this to put this post into one category, so that it appears in category listings.
Other useful variables to define are
PieCrust wouldn’t do anything special with those — it’s just that they
would be commonly used by pages showing those posts.