Skip to content

Commit 1fc1c92

Browse files
author
ginger-tek
committed
updated docs and default layout
1 parent b0261a8 commit 1fc1c92

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,37 @@ This is the global assets directory, in which you can organize your CSS, JavaScr
6060
Routes are defined separately from pages to easily manage the content and access of each route.
6161

6262
## Route Properties
63-
Each route is defined as a key on the `routes` property in `config.json` whose value is an object with properties that define the route's page title and content. Additional properties can be set for metadata/SEO purposes, but the title and file/body properties are the only necessary properties:
63+
Each route is defined as a key on the `routes` property in `config.json` whose value is an object with properties that define the route's page title and content.
64+
65+
|Name|Data Type|Required?|Note|
66+
|---|---|---|---|
67+
|`title`|`string`|Yes|Page title|
68+
|`file`|`string`|Conditional|Required if `body` not set. Overwrites `body` value with rendered content|
69+
|`body`|`string`|Conditional|Required if `file` not set. Throws error if neither `file` and `body` set|
70+
|`layout`|`string`|No|If set to valid path, will override default `layout`. If set to false, no layout is used and page body is echoed as is|
71+
72+
Additional arbitrary properties can be set for metadata/SEO purposes, but the title and file/body properties are the only necessary properties:
6473
```json
6574
{
6675
"routes": {
6776
"/": {
6877
"title": "Page Title",
6978
"file": "pages/page.php",
7079
"description": "This is a description of the page for SEO",
71-
"thumbnail": "https://domain.com/path/to/image/for/seo.jpg"
80+
"thumbnail": "/assets/img/seo.jpg"
7281
}
7382
}
7483
}
7584
```
76-
|Name|Data Type|Required?|Note|
77-
|---|---|---|---|
78-
|`title`|`string`|Yes|Page title|
79-
|`file`|`string`|Conditional|Required if `body` not set. Overwrites `body` value with rendered content|
80-
|`body`|`string`|Conditional|Required if `file` not set. Throws error if neither `file` and `body` set|
81-
|`layout`|`string`|No|If set to valid path, will override default `layout`. If set to false, no layout is used and page body is echoed as is|
85+
You can then implement your additional properties in your layout, such as for social media SEO tags. Use the `@` warning suppressing syntax for when some routes don't have the property specified:
86+
```html
87+
<head>
88+
<title><?= $config->siteName ?> - <?= $page->title ?></title>
89+
<meta name="og:title" content="<?= $page->title ?>">
90+
<meta name="og:description" content="<?= @$page->description ?>">
91+
<meta name="og:image" content="<?= @$page->thumbnail ?>">
92+
</head>
93+
```
8294

8395
## Dynamic Routes
8496
You can also specify non-static matching routes for the key string. Use the `:param` syntax to dynamically match a route and have its parameters set to the parsed values from the incoming URI:

layouts/default.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<!DOCTYPE html>
2-
<html>
2+
<html lang="en">
33

44
<head>
5+
<meta charset="UTF-8">
56
<title><?= $config->siteName ?> - <?= $page->title ?></title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<meta name="og:title" content="<?= $page->title ?>">
9+
<meta name="og:description" content="<?= @$page->description ?>">
10+
<meta name="og:image" content="<?= @$page->thumbnail ?>">
611
</head>
712

813
<body>
@@ -16,4 +21,4 @@
1621
</main>
1722
</body>
1823

19-
</html>
24+
</html>

0 commit comments

Comments
 (0)