Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
Update 3.Layouts.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Jul 4, 2016
1 parent f5cc83a commit 604cac8
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions docs/3.Layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ A layout is a [Twig](http://twig.sensiolabs.org) template.

## Fallback logic

Node type _Homepage_:
The used layout is determined by the following logic.

If node type is _Homepage_:
1. ```index.html```
2. ```_default/list.html```
3. ```_default/page.html```

Node type _Section_:
If node type is _Section_:
1. ```section/$section.html``` (Where ```$section``` is the Section name)
2. ```_default/section.html```
3. ```_default/list.html```

Node type _Taxonomy_:
If node type is _Taxonomy_:
1. ```taxonomy/$singular.html``` (Where ```$singular``` is the taxonomy name)
2. ```_default/taxonomy.html```
3. ```_default/list.html```

Node type _Terms_:
If node type is _Terms_:
1. ```taxonomy/$singular.terms.html``` (Where ```$singular``` is the taxonomy name)
2. ```_default/terms.html```

Page without node type:
Otherwise:
1. ```$section/page.html``` (Where ```$section``` is the Section name)
2. ```$section/$layout.html``` (Where ```$layout``` is the layout name)
3. ```$layout.html```
Expand Down Expand Up @@ -56,6 +58,7 @@ Contains all variables setted in the page's front matter.
| Variable | Description | Example |
| --------------- | -------------------------------- | ------------- |
| page.title | Title | "Post 1" |
| page.content | HTML content | _HTML_ |
| page.section | Section | "blog" |
| page.id | Unique id | "blog/post-1" |
| page.pathname | Full path | "blog/post-1" |
Expand All @@ -66,22 +69,29 @@ Contains all variables setted in the page's front matter.
| page.categories | Categories array | [Ca, Cb] |
| ... | | |

### Paginator
### Pagination

| Variable | Description |
| --------------------- | ------------------------- |
| page.pagination.pages | Paginated pages |
| page.pagination.prev | Path to the previous page |
| page.pagination.next | Path to the next page |

_(WIP)_
### Taxonomy

| Variable | Description |
| -------------- | ------------------------- |
| paginator.prev | Path to the previous page |
| paginator.next | Path to the next page |
| Variable | Description |
| ------------- | --------------------------- |
| page.singular | Taxonomy name |
| page.plural | Taxonomy name (plural form) |
| page.terms | Path to the next page |

### PHPoole

| Variable | Description |
| ----------------- | ------------------------------ |
| phpoole.url | URL to the official website |
| phpoole.version | Current version |
| phpoole.poweredby | " PHPoole-library v" + version |
| Variable | Description |
| ----------------- | ----------------------------- |
| phpoole.url | URL to the official website |
| phpoole.version | Current version |
| phpoole.poweredby | "PHPoole-library v" + version |

## Example

Expand All @@ -102,6 +112,7 @@ Creates an URL.
```
{{ url(page) }}
{{ url('tags/' ~ tag) }}
{{ url(menu.url) }}
```

### Filters
Expand All @@ -113,6 +124,13 @@ Truncates a string to 450 char and adds '…'.
{{ string|excerpt }}
```

#### _sortByTitle_

Sorts a pages collection by title.
```
{{ pages|sortByTitle }}
```

#### _sortByDate_

Sorts a pages collection by date.
Expand Down

0 comments on commit 604cac8

Please sign in to comment.