| Class | Nanoc::DataSources::Filesystem |
| In: |
lib/nanoc/data_sources/filesystem.rb
|
| Parent: | Nanoc::DataSource |
The filesystem data source is the default data source for a new nanoc site. It stores all data as files on the hard disk.
None of the methods are documented in this file. See Nanoc::DataSource for documentation on the overridden methods instead.
The filesystem data source stores its pages in nested directories. Each directory represents a single page. The root directory is the ‘content’ directory.
Every directory has a content file and a meta file. The content file contains the actual page content, while the meta file contains the page‘s metadata, formatted as YAML.
Both content files and meta files are named after its parent directory (i.e. page). For example, a page named ‘foo’ will have a directorynamed ‘foo’, with e.g. a ‘foo.markdown’ content file and a ‘foo.yaml’ meta file.
Content file extensions are not used for determining the filter that should be run; the meta file defines the list of filters. The meta file extension must always be ‘yaml’, though.
Content files can also have the ‘index’ basename. Similarly, meta files can have the ‘meta’ basename. For example, a parent directory named ‘foo’ can have an ‘index.txt’ content file and a ‘meta.yaml’ meta file. This is to preserve backward compatibility.
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 are stored in the ‘assets’ directory (surprise!). The structure is very similar to the structure of the ‘content’ directory, so see the Pages section for details on how this directory is structured.
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 are stored as directories in the ‘layouts’ directory. Each layout contains a content file and a meta file. The content file contain the actual layout, and the meta file describes how the page should be handled (contains the filter that should be used).
For backward compatibility, a layout can also be a single file in the ‘layouts’ directory. Such a layout cannot have any metadata; the filter used for this layout is determined from the file extension.
Templates are located in the ‘templates’ directroy. Every template is a directory consisting of a content file and a meta file, both named after the template. This is very similar to the way pages are stored, except that templates cannot be nested.
Code is stored in ’.rb’ files in the ‘lib’ directory. Code can reside in sub-directories.
| PAGE_DEFAULTS_FILENAME | = | 'page_defaults.yaml' |
| PAGE_DEFAULTS_FILENAME_OLD | = | 'meta.yaml' |
| ASSET_DEFAULTS_FILENAME | = | 'asset_defaults.yaml' |
| vcs | [RW] | VCSes ########## |