summaryrefslogtreecommitdiff
path: root/web/tutorials/02-basics.markdown
blob: b79d336d61de2d148c2a2ce2da26965a05ee055a (plain)
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
---
title: The basics
author: Jasper Van der Jeugt
---

Building and cleaning
---------------------

If you followed along with the previous tutorial, you should now have the
example site up and running. By running `stack exec site build`, you created
two directories:

- `_site`, with your site as HTML files, ready to be deployed;
- `_cache`, which Hakyll uses internally.

`stack exec site clean` removes these directories, and `stack exec site
rebuild` performs a `clean` and then a `build`.

In general, you want to use `stack exec site build` when you just made changes
to the contents of your website. If you made changes to `site.hs`, you need to
recompile `site.hs` followed by a rebuild:

    stack build
    stack exec site rebuild

At this point, feel free to change some files, `stack exec site build` and see
what happens!

Pages and metadata
------------------

You might've noticed that the markdown pages all start with a block:

    ---
    title: Contact
    ---

    I live...

This is entirely optional, but useful for providing extra information
("metadata") about items. All items can have metadata: since it's not really
convenient to add such a header to an image, you can also do this using a
separate file.

For a file called `images/foo.png`, you can add an `images/foo.png.metadata`
file with contents:

    title: An image of a cow