-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout.page
executable file
·198 lines (160 loc) · 6.29 KB
/
about.page
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
---
title: Page
description: Converts file and folder structure into web pages.
icon: 'M19 2L14 6.5V17.5L19 13V2M6.5 5C4.55 5 2.45 5.4 1 6.5V21.16C1 21.41 1.25 21.66 1.5 21.66C1.6 21.66 1.65 21.59 1.75 21.59C3.1 20.94 5.05 20.5 6.5 20.5C8.45 20.5 10.55 20.9 12 22C13.35 21.15 15.8 20.5 17.5 20.5C19.15 20.5 20.85 20.81 22.25 21.56C22.35 21.61 22.4 21.59 22.5 21.59C22.75 21.59 23 21.34 23 21.09V6.5C22.4 6.05 21.75 5.75 21 5.5V19C19.9 18.65 18.7 18.5 17.5 18.5C15.8 18.5 13.35 19.15 12 20V6.5C10.55 5.4 8.45 5 6.5 5Z'
color: '#75522f'
author: Taufik Nurrohman
type: Markdown
version: 3.1.4
...
This extension uses the structure of the page file location in the `.\lot\page` folder to enable the basic functions of
a web site. This extension also adds some useful properties to the `$site` and `$state` variable.
### Page
A page is a plain text file stored in the `.\lot\page` folder. The correct file name format for a page consists of the
characters `a`, `b`, `c`, `d`, `e`, `f`, `g`, `h`, `i`, `j`, `k`, `l`, `m`, `n`, `o`, `p`, `q`, `r`, `s`, `t`, `u`, `v`,
`w`, `x`, `y`, `z`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, and `-`. The characters `.` and `_` can also be
used, but should be used sparingly, as not all GUI applications like to preserve these characters for security reasons:
~~~ .txt
.\
└── lot\
└── page\
├── dolor-sit-amet.page ✔
├── lorem-ipsum.page ✔
└── no-no-no.page ✔
~~~
A `.page` extension is the default file extension for page files to indicate that the page is active and publicly
viewable. There are several other page file extensions that can also be used:
`.page`
: Publicly available and appear together in the list of public pages.
`.archive`
: Publicly available, but does not appear together in the list of public pages.
`.draft`
: Not publicly available and will not appear together in the list of public pages.
For example, to access and read the `.\lot\page\lorem-ipsum.page` file from the web site, visit
`http://127.0.0.1/lorem-ipsum`.
A minimum page file content consists of a text. Any text. With optional header data written in YAML syntax:
~~~ .yaml
---
title: Page Title
description: Page description.
type: HTML
...
<p>This page content is valid.</p>
~~~
~~~ .html
<p>This page content is also valid.</p>
~~~
Any missing header data will be replaced by the default data that is automatically generated. Let’s say that the default
data is loaded first and then overwritten by the header data of the current page. Most of the default data is just an
empty string or `null`, which in most cases can also be evaluated as a boolean `false`:
~~~ .php
return [
'x' => [
'page' => [
'page' => [
'author' => null,
'description' => null,
'title' => null,
'type' => 'Markdown'
]
]
]
];
~~~
A folder with the same name as the page name can also link a page file to other files:
~~~ .txt
.\
└── lot\
└── page\
├── lorem-ipsum\ ✔
├── dolor-sit-amet.page
├── lorem-ipsum.page
└── no-no-no.page
~~~
Users can store other data related to the page file in this folder. If the file name ends with the extension `.data`,
this file will act as an external page property. This is called data.
### Data
External data has a higher priority than internal header data because they are easier to parse. So if you have a
`title.data` file in the `.\lot\page\lorem-ipsum` folder, the contents of that file will overwrite the title property
written in the page file:
~~~ .txt
.\
└── lot\
└── page\
├── lorem-ipsum\
│ ├── author.data ✔
│ ├── description.data ✔
│ └── title.data ✔
├── dolor-sit-amet.page
├── lorem-ipsum.page
└── no-no-no.page
~~~
Users can also add other page files to the folder. These can then be called as child pages. Child pages override the
page view of the current file and change the page view to a list of child pages:
~~~ .txt
.\
└── lot\
└── page\
├── lorem-ipsum\
│ ├── author.data
│ ├── description.data
│ ├── title.data
│ ├── lorem-ipsum-child-1.page ✔
│ ├── lorem-ipsum-child-2.page ✔
│ └── lorem-ipsum-child-3.page ✔
├── dolor-sit-amet.page
├── lorem-ipsum.page
└── no-no-no.page
~~~
Place an empty file named `.archive` or `.page` in the folder to disable the page listing view in a particular folder:
~~~ .txt
.\
└── lot\
└── page\
├── lorem-ipsum\
│ └── .page ✔
└── lorem-ipsum.page
~~~
And so on…
~~~ .txt
.\
└── lot\
└── page\
├── lorem-ipsum\
│ ├── lorem-ipsum-child-1\
│ │ ├── author.data
│ │ ├── description.data
│ │ ├── title.data
│ │ ├── lorem-ipsum-child-1-1.page
│ │ ├── lorem-ipsum-child-1-2.page
│ │ └── lorem-ipsum-child-1-3.page
│ ├── author.data
│ ├── description.data
│ ├── title.data
│ ├── lorem-ipsum-child-1.page
│ ├── lorem-ipsum-child-2.page
│ └── lorem-ipsum-child-3.page
├── dolor-sit-amet.page
├── lorem-ipsum.page
└── no-no-no.page
~~~
---
These page conditional statements are available to quickly determine the type of page we are on:
`$site->has('next')`
: Returns `true` if it is possible to go to the next page.
`$site->has('page')`
: Returns `true` if there is a page to load.
`$site->has('pages')`
: Returns `true` if there are pages to load.
`$site->has('parent')`
: Returns `true` if current page has parent page.
`$site->has('prev')`
: Returns `true` if it is possible to go to the previous page.
`$site->is('error')`
: Returns `404` if there is no page or pages to load.
`$site->is('home')`
: Returns `true` on home page.
`$site->is('page')`
: Returns `true` on single page view.
`$site->is('pages')`
: Returns `true` on multiple page view.