Coder Social home page Coder Social logo

phile-familytwo's Introduction

PhileFamilyTwo

Continues on from quasipickle's original plugin.

Now updated to be compatible with the latest version of Phile and adds the option to include current folder in the sibling list.


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

Installation

  1. Create following directory structure phile_install_dir/plugins/annabel82/philefamilytwo
  2. Download and place the repository files in that directory.
  3. Modify your config file to include the plugin. For example:
$config['plugins'] = array(
	'annabel82\\philefamilytwo' => array('active' => true),
);

Usage

Your template files will now have 2 new variables: {{ siblings }} and {{ ancestors}}.

Siblings

  • {{ 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

  • {{ 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 additional is_dir property.

Options

show_current_location Type: boolean Default: TRUE

If TRUE the current location will be included in the sibling list. This is useful if you're building menus, and you wish the included items to be static in order to avoid popping (where the values change) when changing pages.

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.

Examples

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
**Note that when viewing a non-index page (ie: /recipes/cakes/redvelvet.md), the index page of the current directory is the last ancestor.**

phile-familytwo's People

Contributors

quasipickle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.