Why ?
That’s it ! I’ve setup an Hakyll website: the one you’re currently browsing.
I started working as a freelance developer and I needed a website for this activity. As I know there is this out there this great library called Hakyll to generate static websites, I couldn’t help using Haskell for this job. The feedback from the users of the library are usually great, so I needed to give it a go. It should be a great way to do something useful and have fun in the same time.
Hakyll
Basically, what Hakyll does is to read some content written in any format supported by pandoc, and apply templates to generate html pages. Each resource, files or images, can have metadata associated to them that can then be used in the templates.
Hakyll can also check that the links in the generated website are valid which is great. It also has a command which starts a local web server and watch for any modification in the current directory. When any modification occurs a build of the site is triggered. It makes the workflow of working on the content of the website very nice: edit a file, save it and hit F5 in the browser to see the result.
This website
So here it is. The website is up and running and I’m very satisfy by the experience overall. I didn’t want to write any html so the pages of this website are generated from markdown files exclusively. I have one Haskell executable in charge of generating the whole site. I’ve also written a small script to deploy the website on the server. The whole source code of the website is visible on github. Feel free to check it out.
I wanted a very simple and straight forward structure. So here it goes:
- there is an index.md at the root of the website
- some other pages are located in the pages directory
- some blog posts are located in the posts directory
These are the files and directories I put with my content in. When I want a new page, I add it to the pages directory. When I write a new post, I add a new file in the posts directory. Simple, easy. Then Hakyll let me automate the conversion of these files in html and the generation of these pages:
- the posts page which contains all the blog posts
- the last posts list on the index page
- the rss feed
- the sitemap.xml
Design
One last thing, I needed to sort out was the actual design of the website. As I can cope with anything related to code. I have a very hard time making a design from scratch that I actually like. I must confess I’m not very good at choosing colors, fonts, sizes and offsets. Well I guess that’s not my thing. Fortunately, there is plenty of good looking websites I can get inspiration from.
I stubbled on this website which I like the design very much. Its author Jorge was kind enough to let me use its design as a template. And I’m very thankful to him for that.
Conclusion
I’m very happy about how it goes. The experience of using Hakyll was great. The workflow is nice and easy and I like the website design. So I’m looking forward adding more content to it.