[web-devel] Using Hamlet for a static website
mxcantor at gmail.com
Tue May 31 01:18:38 CEST 2011
We do something like this as part of our process. Our case is simpler but it basically involves curl'ing a large HTML file generated to hamlet/Julius as part of our iOS app build process.
On May 31, 2011, at 4:28, Michael Snoyman <michael at snoyman.com> wrote:
> On Mon, May 30, 2011 at 10:17 PM, Neil Mitchell <ndmitchell at gmail.com> wrote:
>> My website at http://community.haskell.org/~ndm/ is based on lots of
>> template files, for example:
>> http://community.haskell.org/~ndm/darcs/website/pages/catch.html (not
>> a real HTML file, but a partial HTML file).
>> These files all start with some metadata, and then have some templated
>> language below, which gets combined with headers/footers to produce my
>> website. I did this all using custom code, but I'd like to move to
>> using Hamlet with YAML, so I can throw away lots of my custom code and
>> so I get lots of additional features I'm currently missing because I
>> have to hand-roll the framework myself. I couldn't find any examples
>> of anything else doing this, so two questions:
>> 1) I couldn't find any easy way to say "run hamlet on each of the
>> files in this directory"? Will I have to do a getDirectoryContents in
>> IO, lift that into Q, and then statically call hamletFile on a list?
>> Then I'll output the HTML to file.
> Yes, that sounds like the most likely-to-succeed approach.
>> 2) Is there an existing example of this? Writing a static site in
>> terms of Hamlet seems like a nice idea, and I can't be the first to
>> have thought of it.
>> Thanks, Neil
> You may have been the first to discuss static Hamlet, but there have
> been some emails off-list about creating static Yesod sites, which
> would overlap quite a bit. I think creating such a system would be
> fairly easy actually: just spider a live site and download all the
> necessary files. With Warp/http-enumerator (or even just going
> straight against WAI), it should be possible to write that very
> trivially. In fact, I don't think it would even be Yesod-specific, so
> if you set up your Hamlet code as a WAI app, I would imagine it would
> work with such a system as well.
> But I'll also agree with Jasper that Hakyll is very nice. I know it
> has (or at least had) some level of Hamlet support, though I'm not
> sure what that's like today.
> web-devel mailing list
> web-devel at haskell.org
More information about the web-devel