You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Docs: Remove dead links and amp up the guide
This project is still linked in many static site lists
as one of the most popular PHP based generators
and stared by many people. It's old and has it's quirks
(see https://stitcher.io/blog/a-simple-approach-to-static-generation),
but it's actually working.
So a little upgrade to the docs - removing dead links,
add sidenotes, explain some files - is probably okay.
Furthermore, in view of the continuing popularity of the project
despite the lack of updates, I believe it makes sense to explain
the development status transparently and concisely:
The project is in maintenance mode. That's it.
**High performance, static websites for PHP developers.**
6
+
7
+

8
+
9
+
Stitcher sites utilize a simple concept that allows PHP developers to quickly publish a structured website or blog.
10
+
**Data entries** are mapped onto **templates** and “stitched” together via a **config file**.
11
+
12
+
Data entries can be provided in many ways:
13
+
JSON or YAML files, MarkDown files, images, SASS or CSS, JavaScript, folders and more.
10
14
11
-
### Why Stitcher?
15
+
Templates may use Twig or Smarty to output a desired HTML markup.
12
16
13
-
Stitcher differs from many other static site generator in two areas. First of all: **performance is key**. Stitcher is built from its core for high performance websites. All tools available to you put performance on the first place. Secondly, it doesn't try to add extra syntax to existing formats. Stitcher provides a robust set of tools **for developers** to build with, and not a lot of hacks so everything fits in one file.
17
+
And the config file: well, it's a small YAML.
18
+
19
+
## Why Stitcher?
20
+
21
+
Stitcher differs from many other static site generators in two areas.
22
+
First of all: **performance is key**. Stitcher is built from its core for high performance websites.
23
+
All tools available to you put performance on the first place.
24
+
Secondly, it doesn't try to add extra syntax to existing formats. Stitcher provides a robust set of tools
25
+
**for developers** to build with, and not a lot of hacks so everything fits in one file.
14
26
15
27
Also important to note, included with Stitcher:
16
28
@@ -22,8 +34,22 @@ Also important to note, included with Stitcher:
22
34
- Built-in SASS support
23
35
- JavaScript and CSS minification
24
36
- Built-in SEO and meta tag optimizations
37
+
- CLI to run common actions
38
+
39
+
## Setup
25
40
26
-
A quick look at Stitcher:
41
+
```bash
42
+
composer create-project pageon/stitcher
43
+
```
44
+
45
+
For development purposes you may run the internal PHP server and point it to the `/dev` directory.
46
+
You should see an introduction guide and example blog files.
47
+
48
+
## Quick Guide
49
+
50
+
A quick look at Stitcher.
51
+
52
+
The site config defines template and data source files for different routes. This is a minimal blog setup:
27
53
28
54
```yaml
29
55
# site.yml
@@ -43,6 +69,9 @@ A quick look at Stitcher:
43
69
field: id
44
70
```
45
71
72
+
Each blog post could come from different content sources, which are listed in data files.
73
+
Metadata is stored here as well.
74
+
46
75
```yaml
47
76
# data/blog.yml
48
77
@@ -61,6 +90,18 @@ foo_bar:
61
90
image: foo_bar.jpg
62
91
```
63
92
93
+
One blog post, in this example it's just a MarkDown file.
94
+
95
+
```markdown
96
+
# data/blog/hello.md
97
+
98
+
# Hello World
99
+
100
+
This is a **MarkDown** file. That's it.
101
+
```
102
+
103
+
And finally, a template to render a single post:
104
+
64
105
```html
65
106
<!-- blog.post.html -->
66
107
@@ -79,21 +120,17 @@ foo_bar:
79
120
{% endblock %}
80
121
```
81
122
123
+
The [full documentation](src/data/guide.md) is shown when you run the project in a server.
82
124
83
-
You can read more about it on [the Stitcher website](http://stitcher.pageon.be).
84
-
85
-
### Upcoming features
125
+
## Examples
86
126
87
-
Stitcher is in alpha development, so new features are still being made. Here's a list of what's to come before a stable v1 release:
127
+
This project is used, with some rather strong modifications, on [stitcher.io](https://stitcher.io),
128
+
the source code for this blog is available at [github.com/brendt/stitcher.io](https://github.com/brendt/stitcher.io).
88
129
89
-
- Plugin support
90
-
- Theme support
130
+
## Development
91
131
92
-
Also, we're already thinking about the farther future:
132
+
The core library is maintained in [github.com/pageon/stitcher-core](https://github.com/pageon/stitcher-core).
93
133
94
-
- Localisation
95
-
- URL generation
96
-
- CLI Configuration and setup
97
-
- site:deploy command
98
-
- Frontend Filters
99
-
- Form support with Lumen/Slim
134
+
⌛ This project was created mainly for personal usage. It's in maintenance mode only.
135
+
The development [faded out](https://stitcher.io/blog/a-simple-approach-to-static-generation) a while ago
136
+
and the core will be replaced with a solution based on another framework eventually.
Copy file name to clipboardExpand all lines: src/data/guide.md
+45-35Lines changed: 45 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,31 @@
1
+
# Guide
2
+
3
+
## Building a site with Stitcher
4
+
5
+
Stitcher sites utilize a simple concept that allows PHP developers to quickly publish a structured website or blog.
6
+
**Data entries** are mapped onto **templates** and “stitched” together via a **config file**.
7
+
8
+
The goal is simple: create blazing fast websites. Stitcher will parse all your templates into static HTML pages,
9
+
will parse and minify CSS and JavaScript, will optimize images using ``srcset`` and provides useful developer tools
10
+
to aid you in setting things up smoothly.
11
+
1
12
## Installation
2
13
3
-
```sh
4
-
composer create-project brendt/stitcher-site
14
+
When you read this guide you probably have set up the project already. If not, run
15
+
16
+
```bash
17
+
composer create-project pageon/stitcher
5
18
```
6
19
7
-
## Building a site with Stitcher
20
+
For development purposes you may run the internal PHP server and point it to the `/dev` directory.
21
+
22
+
```bash
23
+
php -S localhost:80 -t dev/
24
+
```
8
25
9
-
Stitcher sites can be built by anyone with basic HTML knowledge: **data entries** are mapped onto **templates** which are accessible via **a URL**.
10
-
These two components (entries and templates) are mapped - *stitched* - together via a **config file**. Data entries can be provided in many ways:
11
-
JSON or YAML files, MarkDown files, images, SASS or CSS, JavaScript, folders and more.
26
+
See »Host setup« to find out how to set up different hosts for development and production.
12
27
13
-
The goal is simple: create blazing fast websites. Stitcher will parse all your templates into static HTML pages, will parse and minify CSS and JavaScript,
14
-
will optimize images using ``srcset`` and provides useful developer tools to aid you in setting things up smoothly.
28
+
## File setup
15
29
16
30
### site.yml
17
31
@@ -48,15 +62,15 @@ The ``site.yml`` file, located in the ``src/site`` directory is used to stitch t
48
62
```
49
63
50
64
The ``template`` key is required and provides a path to the required template for this page.
51
-
The ``data`` key isn't required. It takes a collection of variable names (these will be accessible in the template as variables).
52
-
Each variable will need to be loaded. You can either provide a path to a data file (loaded from ``src/data`` by default),
53
-
or you can provide a collection with a `src` and `id` key. This approach will generate detail pages from a collection of data entries.
65
+
The ``data`` key isn't required. It takes a collection of variable names (these will be accessible in the template as variables).
66
+
Each variable will need to be loaded. You can either provide a path to a data file (loaded from ``src/data`` by default),
67
+
or you can provide a collection with a `src` and `id` key. This approach will generate detail pages from a collection of data entries.
54
68
55
69
### Data entries
56
70
57
71
Data entries can be provided in many formats: JSON, YAML, MarkDown, image, folder, ... Examples can be found after running the `site:install` command.
58
-
A data file can either contain data of a single entry, or contain a collection of multiple entries. In the second case, when using JSON or YAML files,
59
-
An extra root key `entries` is required.
72
+
A data file can either contain data of a single entry, or contain a collection of multiple entries. In the second case, when using JSON or YAML files,
73
+
An extra root key `entries` is required.
60
74
61
75
```yaml
62
76
entries:
@@ -79,8 +93,7 @@ See the `src/data` folder files for a more thorough reference.
79
93
80
94
### Templates
81
95
82
-
At this moment, Stitcher only supports Smarty as a template engine. Support for more engines will be added in the future.
83
-
In a template, all functionality of the engine is available, and all variables provided in `site.yml` are available.
96
+
In a template, all functionality of the engine is available, and all variables provided in `site.yml` are available.
84
97
85
98
```html
86
99
{extends 'index.tpl'}
@@ -98,7 +111,12 @@ At this moment, Stitcher only supports Smarty as a template engine. Support for
98
111
{/block}
99
112
```
100
113
101
-
### Helpers
114
+
### Config
115
+
116
+
The `config.yml` file provides some configuration options, to set directory paths, image rendering config, meta config and minification options.
117
+
See the config file for more information.
118
+
119
+
## Helpers
102
120
103
121
Stitcher provides some helper functions in aid of creating fast websites.
104
122
@@ -128,30 +146,23 @@ Stitcher provides some helper functions in aid of creating fast websites.
128
146
</html>
129
147
```
130
148
131
-
### Config
149
+
## Commands
132
150
133
-
The `config.yml` file provides some configuration options, to set directory paths, image rendering config, meta config and minification options.
134
-
See the config file for more information.
151
+
Stitcher offers a command line script to run some static site actions.
135
152
136
-
### Commands
153
+
Run `./stitcher` to see the list of available commands and options. Some of them are:
137
154
138
155
- `site:install`: Copy a base install example.
139
156
- `site:generate [url]`: Generate the whole site, or a specific URL from `sites.yml`.
140
157
- `site:clean [--force]`: Remove all the generated files.
141
158
- `router:list`: List all available URLs from `sites.yml`.
142
159
- `router:dispatch url`: Debug a specified URL.
143
160
144
-
### Developer controller
145
-
146
-
The developer controller can be used to generate a single URL on-the-fly. Thus enabling a developer to make changes to data entries, configs or templates; and see these changes in real-time, without the need of manually generating the website again.
161
+
## Host setup
147
162
148
-
It's obvious that this approach takes a bit more rendering time, so web pages will be slower.
163
+
Stitcher requires at least one virtual host, two if you'd want to use the development mode.
149
164
150
-
### Host setup
151
-
152
-
Stitcher requires at least one virtual host, two if you'd want to use the developers controller.
153
-
154
-
**production**
165
+
**Production**
155
166
156
167
```xml
157
168
<VirtualHost *:80>
@@ -167,7 +178,7 @@ Stitcher requires at least one virtual host, two if you'd want to use the develo
167
178
</VirtualHost>
168
179
```
169
180
170
-
**development**
181
+
**Development**
171
182
172
183
```xml
173
184
<VirtualHost *:80>
@@ -183,9 +194,8 @@ Stitcher requires at least one virtual host, two if you'd want to use the develo
183
194
</VirtualHost>
184
195
```
185
196
186
-
Don't forget to add a local host in ``/ets/hosts``.
197
+
The development mode can be used to generate a single URL on-the-fly.
187
198
188
-
```
189
-
127.0.0.1 stitcher.local
190
-
127.0.0.1 dev.stitcher.local
191
-
```
199
+
Thus enabling developers to make changes to data entries, configs or templates
200
+
and see these changes in real-time, without the need of manually generating the website again.
201
+
It's obvious that this approach takes a bit more rendering time, so web pages will be slower.
0 commit comments