Overview

Last updated 2 months ago

Standard Project Structure

Here is the standard project structure you'll see in DocPad projects:

  • my-website/

    • out/

    • src/

      • render/ (also documents/ for backwards compatibility)

      • static/ (also files/ for backwards compatibility)

      • layouts/

    • docpad.coffee

    • package.json

The out directory

This directory contains anything that DocPad generates. Any new files added to the `src` directory will be found here after being rendered and written by DocPad. However any files that are deleted from the src directory will not be deleted from the out directory by DocPad, you have to delete them manually. So if you remove a file and it's still there remember to delete it manually. ;-)

The src directory

This directory contains your website's source files. It contains your layouts, files to be rendered and be in the output and files that are not to be rendered but will still be in the output. The `src` can have the following folders:

  • The layouts directory

  • The render directory (also documents for backwards compatibility)

  • The static directory (also files for backwards compatibility)

The render and documents directories, and the static and files directories, are merged; files appearing in either are rendered or copied to the output. However, you should use the former names rather than the latter to conform with the latest naming conventions.

The layouts directory

Layouts work in a very similar way to files in render, in that they are rendered and they support meta data. Unlike the files in render, however, they are not output to the out directory, as they only exist to wrap files in render and other layouts within themselves. Layouts work in a nested fashion, with the desired layout being defined by the layout meta data property within the child layout/document.

Layouts should include child content, which is done using the content Template Data variable. For instance, the code to use the content variable with the [Eco](https://github.com/sstephenson/eco/) templating engine via the [Eco DocPad plugin](https://github.com/docpad/docpad-plugin-eco) would be `<%- @content %>`.