on 5dba607 help sign in
hakyll/web/tutorials/faq.markdown
82 lines 2.9 kB history raw
1---
2title: FAQ
3---
5## "File name does not match module name" on Mac OS
7 Hakyll.hs:1:1:
8 File name does not match module name:
9 Saw: `Main'
10 Expected: `Hakyll'
12Is an error encountered on Mac OS when `hakyll.hs` is located on a
13case-insensitive filesystem. A workaround is to rename it to something that
14isn't the name of the module, for example, `site.hs`.
16## `pageCompiler`/Hakyll/Pandoc eats my HTML!
18Sometimes, it can seem that HTML pages are stripped of some arbitrary tags, e.g.
19`<div>`'s. The issue here is that, when using the default `pageCompiler`, your
20page passes through Pandoc. Pandoc unfortunately strips away this information,
21giving you the "wrong" HTML.
23The solution is not to use `pageCompiler` -- it is very common to write custom
24page processing compiler. The definition of `pageCompiler` is, put simply:
26~~~~~{.haskell}
27pageCompiler =
28 readPageCompiler >>>
29 addDefaultFields >>> -- Sets some things like $path$
30 arr applySelf >>> -- Used to fill in $var$s in the page
31 pageRenderPandoc -- Pass through pandoc
32~~~~~
34You can add your own version in your `hakyll.hs` file:
36~~~~~{.haskell}
37myPageCompiler =
38 readPageCompiler >>>
39 addDefaultFields >>> -- Sets some things like $path$
40 arr applySelf >>> -- Used to fill in $var$s in the page
41~~~~~
43And using this instead of `pageCompiler` should solve the issue.
45## Does Hakyll support syntax highlighting?
47Syntax highlighting is enabled by default in Hakyll. However, you also need to
48enable it in pandoc. If no syntax highlighting shows up, try
50 [jasper@phoenix] cabal install --reinstall -fhighlighting pandoc
52## When should I rebuild and when should I build?
54If you execute a `./hakyll build`, Hakyll will build your site incrementally.
55This means it will be very fast, but it will not pick up _all_ changes.
57- In case you edited `hakyll.hs`, you first want to compile it again.
58- It is generally recommended to do a `./hakyll rebuild` before you deploy your
59 site.
61After rebuilding your site, all files will look as "modified" to the filesystem.
62This means that when you upload your site, it will usually transfer all files --
63this can generate more traffic than necessary, since it is possible that some
64files were not actually modified. If you use `rsync`, you can counter this using
65the `--checksum` option.
67## Problem with regex-pcre dependency on Mac OS
69Hakyll requires [regex-pcre], which might fail to build on Mac OS. To solve
70this problem, make sure the [pcre] C library is installed (via homebrew or
71macports). Then install [regex-pcre] using:
73 cabal install --extra-include-dirs=/usr/local/include regex-pcre
75or
77 cabal install --extra-include-dirs=/opt/local/include regex-pcre
79...and proceed to install Hakyll the regular way.
81[regex-pcre]: http://hackage.haskell.org/package/regex-pcre
82[pcre]: http://www.pcre.org/