hakyll/web/tutorials/02-basics.markdown

49 lines
1.3 KiB
Markdown
Raw Normal View History

2011-02-12 14:16:42 +00:00
---
2011-06-13 16:26:04 +00:00
title: The basics
2011-10-09 10:36:35 +00:00
author: Jasper Van der Jeugt
2011-02-12 14:16:42 +00:00
---
2011-02-10 11:30:06 +00:00
2012-12-14 11:12:28 +00:00
Building and cleaning
---------------------
2011-02-10 11:30:06 +00:00
2012-12-14 11:12:28 +00:00
If you followed along with the previous tutorial, you should now have the
example site up and running. By running `./site build`, you created two
directories:
2011-06-13 06:51:25 +00:00
2012-12-14 11:12:28 +00:00
- `_site`, with your site as HTML files, ready to be deployed;
- `_cache`, which Hakyll uses internally.
2011-06-13 06:51:25 +00:00
2012-12-14 11:12:28 +00:00
`./site clean` removes these directories, and `./site rebuild` performs a
`clean` and then a `build`.
2011-06-13 06:51:25 +00:00
2013-06-04 08:10:34 +00:00
In general, you want to use `./site build` when you just made changes to the
contents of your website. If you made important changes to `site.hs`, you need
to recompile `site.hs` followed by a rebuild:
ghc --make site.hs
./site rebuild
2011-05-29 13:34:37 +00:00
2012-12-15 23:21:59 +00:00
At this point, feel free to change some files, `./site build` and see what
happens!
2011-05-29 13:34:37 +00:00
2012-12-15 23:21:59 +00:00
Pages and metadata
------------------
2012-12-14 12:49:51 +00:00
2012-12-15 23:21:59 +00:00
You might've noticed that the markdown pages all start with a block:
2012-12-14 12:49:51 +00:00
2012-12-15 23:21:59 +00:00
---
title: Contact
---
2012-12-14 12:49:51 +00:00
2012-12-15 23:21:59 +00:00
I live...
2012-12-14 12:49:51 +00:00
2012-12-15 23:21:59 +00:00
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.
2012-12-14 12:49:51 +00:00
2012-12-15 23:21:59 +00:00
For a file called `images/foo.png`, you can add an `images/foo.png.metadata`
file with contents:
2012-12-14 12:49:51 +00:00
2012-12-15 23:21:59 +00:00
title: An image of a cow