Class Nanoc::DataSources::FilesystemCombined
In: lib/nanoc/data_sources/filesystem_combined.rb
Parent: Nanoc::DataSource

Pages

The filesystem data source stores its pages in nested directories. A page is represented by a single file. The root directory is the ‘content’ directory.

The metadata for a page is embedded into the file itself. It is stored at the top of the file, between ’——’ (five dashes) separators. For example:

  -----
  filters_pre: [ 'redcloth' ]
  -----
  h1. Hello!

The path of a page is determined as follows. A file with an ‘index.*’ filename, such as ‘index.txt’, will have the filesystem path with the ‘index.*’ part stripped as a path. For example, ‘foo/bar/index.html’ will have ’/foo/bar/’ as path.

A file with a filename not starting with ‘index.’, such as ‘foo.html’, will have a path ending in ‘foo/’. For example, ‘foo/bar.html’ will have ’/foo/bar/’ as path.

Note that it is possible for two different, separate files to have the same path. It is therefore recommended to avoid such situations.

Some more examples:

  content/index.html          --> /
  content/foo.html            --> /foo/
  content/foo/index.html      --> /foo/
  content/foo/bar.html        --> /foo/bar/
  content/foo/bar/index.html  --> /foo/bar/

File extensions are ignored by nanoc. The file extension does not determine the filters to run on it; the metadata in the file defines the list of filters.

Page defaults

The page defaults are loaded from a YAML-formatted file named ‘page_defaults.yaml’ at the top level of the nanoc site directory. For backward compatibility, the file can also be named ‘meta.yaml’.

Assets

Assets are stored in a way similar to pages. The attributes are merged into the asset. This does mean, however, that only textual assets are supported, as there is no way to embed attributes in binary assets.

Asset defaults

The asset defaults are stored similar to the way page defaults are stored, except that the asset defaults file is named ‘asset_defaults.yaml’ instead.

Layouts

Layouts are stored as files in the ‘layouts’ directory. Similar to pages, each layout consists of a metadata part and a content part, separated by ’——’.

Templates

Templates are located in the ‘templates’ directory. Templates are, just like pages, files consisting of a metadata part and a content part, separated by ’——’.

Code

Code is stored in ’.rb’ files in the ‘lib’ directory. Code can reside in sub-directories.

Methods

vcs  

Constants

PAGE_DEFAULTS_FILENAME = 'page_defaults.yaml'
PAGE_DEFAULTS_FILENAME_OLD = 'meta.yaml'
ASSET_DEFAULTS_FILENAME = 'asset_defaults.yaml'

Attributes

vcs  [RW]  VCSes ##########

Public Instance methods

[Validate]