A plugin for providing sibling and ancestor records to Phile themes. By default, Phile provides {{ pages }}
to theme templates. This plugin adds {{ siblings }}
and {{ ancestors }}
Questions? Comments? Feel free to throw something in the issue tracker
- Create the directory
plugins/family
- Download and place the repository files in that directory.
- Modify your config file to include the plugin. For example:
$config['plugins'] = array(
'family' => array('active' => true),
);
Your template files will now have 2 new variables: {{ siblings }}
and {{ ancestors}}
.
{{ siblings }}
will contain a Page object for each page & subdirectory in the current directory (except the current page).- For subdirectories, the Page object will point to the index.md file of the subdirectory.
{{ siblings }}
will be sorted in default sort order.
{{ ancestors }}
will contain a Page object for each parent, grandparent, etc. directory.- If the current page is not the index page for a directory, then the index page will for the current directory will be the first ancestor.
{{ ancestors }}
will be sorted from last ancestor to first ancestor (the parent directory)- Pages in the
{{ ancestors }}
array will have an additionalis_dir
property.
####sibling_dirs
Type: boolean
Default: TRUE
{{ siblings }}
ordinarily contains an entry for every page that is in the same directory as the currently viewed page. It will also contain an entry for every subdirectory that is in the same directory as the currently viewed page. The entry for each directory will point to the index.md
file in the subdirectory.
Setting this option to FALSE
will cause {{ siblings }}
to only contain entries for pages.
####ancestor_sort
Type: string
Default: 'asc'
If 'asc' (or anything other than 'desc'), the 1st ancestor will be the homepage, and the last ancestor will be the parent.
If 'desc', the 1st ancestor will be the parent, the 2nd the grandparent, etc.
Given this content structure:
/content/
index.md
about.md
recipes/
index.md
pie.md
cakes/
index.md
redvelvet.md
angelfood.md
viewing | Ancestors | Siblings |
---|---|---|
/ | NULL |
/about.md /recipes/index.md |
/recipes/ | /index.md |
/recipes/pie.md /recipes/cakes/index.md |
/recipes/cakes/redvelvet.md |
/index.md /recipes/index.md /recipes/cakes/index.md |
/recipes/cakes/angelfood.md |