This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.yml
78 lines (56 loc) · 2.7 KB
/
default.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
:title: Managing pages
:body: |
Each page is stored in its own directory, it uses a `.yml` file to hold its textual content.
That same `.yml` file is also used to infer the template that will be used for your page. For example, `default.yml` will use the `default.mustache` template.
content/
index/
default.yml
The index page will use the `default.mustache` template.
#### Page variables
Pages have variables for meta information, also, the key and value pairs in the `.yml` file will be cast to variables.
For example - A `.yml` file containing the following:
:title: "All about growing a Bonsai"
:body: |
A bonsai is very difficult care for...
You will need to obtain the agilty of
a cat and the mind strenth of a bear
:skills:
-
:description: "Agility"
:animal: "Cat"
-
:description: "Strength"
:animal: "Bear"
Will have variables of `{{title}}` and `{{body}}` containing strings, `{{skills}}` will be a hash, which can be used to iterate over to list the skills required to become a bonsai sensei.
#### Pre-defined meta variables
You will also have access to variables that contain details about the page in context.
* `permalink` - The full routable path to the page, eg: `/about/our/services`
* `slug` - The last chunk of a page name, this will also be HTML/URI safe
* `name` - A titlecased version of the slug
* `parent` - The direct parent page
* `children` - All of the non-floating pages underneath the current page
* `siblings` - All of the non-floating pages at the same level. Does not include 'self'
* `ancestors` - Each parent up the tree - Useful for writing breadcrumbs
* `navigation` - Top level non-floating pages
#### "Magic" variables
A page that contains subdirectories will receive additional variables, for example:
content/
index/
default.yml
images/
sansei.jpg
miaggi.jpg
The index page will have an array variable of `images`, it will contain a hash:
[
{
:name => "sansei.jpg",
:path => "/index/images/sansei.jpg",
:disk_path => ".../bonsai-site/content/index/images/sansei.jpg"
},
{
:name => "miaggi.jpg",
:path => "/index/images/miaggi.jpg",
:disk_path => ".../bonsai-site/content/index/images/miaggi.jpg"
}
]
This gives you great power and flexibility - You are able to handle pages with different contexts, based on the files that they are able to use or simply iterate over the magic asset variables to render product/project/logo images.