|
|
|
|
4
|
to use. However it does require some knowledge of HTML, CSS, and how
|
4
|
to use. However it does require some knowledge of HTML, CSS, and how
|
5
|
coleslaw processes content.
|
5
|
coleslaw processes content.
|
6
|
|
6
|
|
7
|
-To understand how coleslaw processes a blog, a look at the
|
|
|
8
|
-[overview][ovr] and [hacking][hck] documentation may prove
|
|
|
9
|
-useful. This document will focus mainly on the template engine and how
|
|
|
10
|
-you can influence the resulting HTML.
|
|
|
11
|
-
|
|
|
12
|
-**NOTE**: Themes are not able to change the generated file names or the
|
|
|
13
|
-generated file structure on disk. They can change the resulting HTML, nothing more.
|
|
|
|
|
7
|
+To understand how coleslaw works, a look at the [hacking][hck]
|
|
|
8
|
+documentation will prove useful. This document focuses mainly on the
|
|
|
9
|
+template engine and how you can influence the resulting HTML.
|
14
|
|
10
|
|
15
|
## High-Level Overview
|
11
|
## High-Level Overview
|
16
|
|
12
|
|
|
|
|
|
33
|
|
29
|
|
34
|
Coleslaw generates two types of pages: `index` pages and `post` pages.
|
30
|
Coleslaw generates two types of pages: `index` pages and `post` pages.
|
35
|
Every page other than those in the `posts/` directory is an `index`.
|
31
|
Every page other than those in the `posts/` directory is an `index`.
|
|
|
32
|
+
|
36
|
**Every** page uses the `base.tmpl` and fills in the content using
|
33
|
**Every** page uses the `base.tmpl` and fills in the content using
|
37
|
-either the `post` or `index` templates.
|
|
|
|
|
34
|
+either the `post` or `index` templates. No important logic should be
|
|
|
35
|
+in *any* template, they are only used to give provide consistent layout.
|
38
|
|
36
|
|
39
|
* `base.tmpl` This template generates the outer shell of the HTML.
|
37
|
* `base.tmpl` This template generates the outer shell of the HTML.
|
40
|
It keeps a consistent look and feel for all pages in the blog. The
|
38
|
It keeps a consistent look and feel for all pages in the blog. The
|
|
|
|
|
44
|
That is, any page with more than one content object, e.g. the homepage.
|
42
|
That is, any page with more than one content object, e.g. the homepage.
|
45
|
|
43
|
|
46
|
* `post.tmpl` This templates generates content for the individual posts.
|
44
|
* `post.tmpl` This templates generates content for the individual posts.
|
47
|
- Coleslaw already converts the content of the individual post to HTML
|
|
|
48
|
- by using markdown (or RST). So this template is **not** used to
|
|
|
49
|
- convert an individual post, merely to give it a standard layout.
|
|
|
50
|
|
45
|
|
51
|
Here's a visual example to make things clearer:
|
46
|
Here's a visual example to make things clearer:
|
52
|
```
|
47
|
```
|
|
|
|
|
69
|
it in entirety and then tweak only the CSS of your new theme. A large
|
64
|
it in entirety and then tweak only the CSS of your new theme. A large
|
70
|
amount of visual difference can be had with a minimum of (or no)
|
65
|
amount of visual difference can be had with a minimum of (or no)
|
71
|
template hacking. There is plenty of advice on CSS styling on the web.
|
66
|
template hacking. There is plenty of advice on CSS styling on the web.
|
72
|
-I'm no expert but feel free to send patches to hyde's `style.css` or a
|
|
|
73
|
-recommended CSS resource for this guide.
|
|
|
|
|
67
|
+I'm no expert but feel free to send pull requests modifying theme's
|
|
|
68
|
+CSS or improving this section, perhaps by recommending a CSS resource.
|
74
|
|
69
|
|
75
|
## Creating a Theme from Scratch (with code)
|
70
|
## Creating a Theme from Scratch (with code)
|
76
|
|
71
|
|
|
|
|
|
130
|
|
125
|
|
131
|
### Intermezzo II, Variables provided by Coleslaw
|
126
|
### Intermezzo II, Variables provided by Coleslaw
|
132
|
|
127
|
|
133
|
-The variable that is available in all templates is:
|
|
|
|
|
128
|
+The variable that should be available to all templates is:
|
134
|
- **config** This contains the `.coleslawrc` content.
|
129
|
- **config** This contains the `.coleslawrc` content.
|
135
|
|
130
|
|
136
|
#### Base Template Variables
|
131
|
#### Base Template Variables
|
|
|
|
|
147
|
`.name` and `.slug`.
|
142
|
`.name` and `.slug`.
|
148
|
- **months** A list of all months with posts as `yyyy-mm` strings.
|
143
|
- **months** A list of all months with posts as `yyyy-mm` strings.
|
149
|
- **index** This is the meat of the content. This variable has
|
144
|
- **index** This is the meat of the content. This variable has
|
150
|
- the following keys
|
|
|
151
|
- - `id`, the name of the page that will be rendered
|
|
|
152
|
- - `posts`, a list of posts (see below)
|
|
|
153
|
- - `title`, a string title to display to the user
|
|
|
|
|
145
|
+ the following keys:
|
|
|
146
|
+ - `id`, the name of the page that will be rendered
|
|
|
147
|
+ - `posts`, a list of posts (see below)
|
|
|
148
|
+ - `title`, a string title to display to the user
|
154
|
- **prev** If this index file is part of a chain, the `id`
|
149
|
- **prev** If this index file is part of a chain, the `id`
|
155
|
of the previous index html in the chain.
|
150
|
of the previous index html in the chain.
|
156
|
If this is the first file, the value will be empty.
|
151
|
If this is the first file, the value will be empty.
|
|
|
|
|
220
|
|
215
|
|
221
|
As mentioned earlier, most files have a file name which is a slug of
|
216
|
As mentioned earlier, most files have a file name which is a slug of
|
222
|
some sort. So if you want to create a link to a tag file you should
|
217
|
some sort. So if you want to create a link to a tag file you should
|
223
|
-do something like this: `<a href="${config.domain}/tags/{$tag.slug}.{$config.pageExt}">{$tag.name}</a>`.
|
|
|
|
|
218
|
+do something like this:
|
|
|
219
|
+`<a href="${config.domain}/tags/{$tag.slug}.{$config.pageExt}">{$tag.name}</a>`.
|
224
|
|
220
|
|
225
|
[clt]: https://developers.google.com/closure/templates/
|
221
|
[clt]: https://developers.google.com/closure/templates/
|
226
|
[ovr]: https://github.com/redline6561/coleslaw/blob/master/docs/overview.md
|
222
|
[ovr]: https://github.com/redline6561/coleslaw/blob/master/docs/overview.md
|