In PieCrust, creating pages is a matter of creating a text file in the correct place with the correct name. This mostly depends on the page sources you’re using, but we can go over how it works for the sources involved in the default content model.
We will also mention the chef prepare command, which semi-automates the
process of creating pages by letting you type a lot less than what would be
otherwise needed to create the correctly named text file in the correct folder.
Generally speaking, you should be able to run chef prepare -h and figure it
out on your own.
In addition to creating the text file, you can make PieCrust open your favorite text editor too, with the
prepare/editorsite configuration setting. For more information, see the site configuration reference.
Overview
All pages sources have a file-system endpoint, which is usually a sub-directory of your website’s root directory. They will look for pages inside that endpoint, and load any file that matches that source’s naming convention.
Generally speaking, page sources will load any files that:
- have a
.htmlextension. - have an extension listed in the
site/auto_formatswebsite setting (by default, those are.mdand.textile, for Markdown and Textile formatted pages respectively).
Different sources have different conventions – mostly naming of the page files. We’ll look at how it works for the sources in the default content model. To learn about other sources, see the page sources reference.
Default content model pages
Simple pages
When using the default content model, PieCrust will load simple pages out of the
pages/ endpoint. The relative path of a page from the pages/ directory will
be that page’s slug, i.e. its URL, minus the site’s root, and minus any
optional arguments.
Since there are often no arguments, and the default’s site root is /, it’s
pretty much the same as the page’s URL. So a page located atpages/cooks/ludovic will have an URL of /cooks/ludovic.
Running
chef prepare page cooks/ludovicwill create that page for you, which means you don’t have to bother with creating intermediate sub-directories or whatnot.
Blog posts
When using the default content model, PieCrust will load blog posts out of the
posts/ endpoint. There are different naming conventions available depending on
the site/posts_fs setting:
flat:YYYY-MM-DD_post-slug.extshallow:YYYY/MM-DD_post-slug.exthierarchy:YYYY/MM/DD_post-slug.ext
Where:
YYYY,MM, andDDare the year, month, and day of the post, respectively.post-slugis, well, the post’s slug (i.e. the part of the URL that comes after the site’s root).extis an extension that’s eitherhtml, or something in the site’s auto-formats (usuallymdfor Markdown texts andtextilefor Textile texts).
Running
chef prepare post my-new-blog-postwill create a new blog post with a slug ofmy-new-blog-post, dated today. This makes it quick to write a new blog post!