
I'm pleased to announce the release of yst, now available on HackageDB. yst generates static websites from YAML or CSV data files and StringTemplates. This approach combines the speed, security, and ease of deployment of a static website with the flexibility and maintainability of a dynamic site that separates presentation and data. The easiest way to get a feel for yst is to try it: cabal update cabal install yst yst create testsite cd testsite yst yst attempts to fill a niche between two kinds of site creation tools. On the one hand you have simple static site generators like webgen, webby, nanoc, and my old custom system using make and pandoc. On the other hand, you have dynamic web frameworks like rails and django. For my own smallish websites, I found that the dynamic frameworks were overkill. Nobody but me was going to edit the pages, and I didn't want the trouble of writing and deploying a dynamic site, setting up a web server, and administering a database. A static site would be faster, easier to deploy, and more secure. But the dynamic frameworks offered one thing that the static site generators did not: an easy way to separate data from presentation. This was becoming increasingly important to me as I found myself constantly updating the same information (say, publication data for a paper) in multiple places (say, a LaTeX CV and a differently formatted web listing of papers). What I wanted was a site generation tool that used YAML text files as a database and allowed different kinds of documents to be produced from the same data. I couldn't find anything that did just what I wanted, so I wrote yst. By way of illustration, here are the build instructions for HTML and LaTeX versions of a CV, plus a web page with a list of papers: - url: cv.html title: CV template: cv.st data_common: &cvdata contact: from contact.yaml jobsbyemployer: from jobs.yaml order by start group by employer degrees: from degrees.yaml order by year desc awards: from awards.yaml order by year desc group by title papers: from papers.yaml order by year desc where (not (type = 'review')) reviews: from papers.yaml order by year desc where type = 'review' talks: from talks.yaml where date < '2009-09-01' order by date desc group by title dissertations: from dissertations.yaml order by role then year group by role theses: from theses.yaml order by year then student courses: from courses.yaml order by number group by title data: <<: *cvdata html: yes - url: cv.tex title: CV inmenu: no template: cv.st layout: layout.tex.st data: <<: *cvdata html: yes - url: papers.html title: Papers template: papers.st data: papersbyyear: from papers.yaml order by year desc then title group by year yst's query language is limited, and there are lots of things you can do with a full-fledged database that you can't do with yst. But yst is ideal, I think, for small to medium data-driven sites that are maintained by a single person who likes working with plain text. It scratched my itch, anyway, and I release it in case anyone else has the same itch. Code, documentation, and bug reports: http://github.com/jgm/yst/tree/master John

I had a play with this yesterday and thought it looked very useful (like all of John MacFarlane's tools). I'm probably going to use it for a site I'm working on. -Rob

It's possible to serve the generated site with maid, in case apache is
not available:
cabal update
cabal install maid
yst create testsite
cd testsite
yst
cd site
maid
now goto http://localhost:3000/
On Mon, Aug 3, 2009 at 9:05 AM, John MacFarlane
I'm pleased to announce the release of yst, now available on HackageDB. yst generates static websites from YAML or CSV data files and StringTemplates. This approach combines the speed, security, and ease of deployment of a static website with the flexibility and maintainability of a dynamic site that separates presentation and data.
The easiest way to get a feel for yst is to try it:
cabal update cabal install yst yst create testsite cd testsite yst
yst attempts to fill a niche between two kinds of site creation tools. On the one hand you have simple static site generators like webgen, webby, nanoc, and my old custom system using make and pandoc. On the other hand, you have dynamic web frameworks like rails and django. For my own smallish websites, I found that the dynamic frameworks were overkill. Nobody but me was going to edit the pages, and I didn't want the trouble of writing and deploying a dynamic site, setting up a web server, and administering a database. A static site would be faster, easier to deploy, and more secure. But the dynamic frameworks offered one thing that the static site generators did not: an easy way to separate data from presentation. This was becoming increasingly important to me as I found myself constantly updating the same information (say, publication data for a paper) in multiple places (say, a LaTeX CV and a differently formatted web listing of papers).
What I wanted was a site generation tool that used YAML text files as a database and allowed different kinds of documents to be produced from the same data. I couldn't find anything that did just what I wanted, so I wrote yst. By way of illustration, here are the build instructions for HTML and LaTeX versions of a CV, plus a web page with a list of papers:
- url: cv.html title: CV template: cv.st data_common: &cvdata contact: from contact.yaml jobsbyemployer: from jobs.yaml order by start group by employer degrees: from degrees.yaml order by year desc awards: from awards.yaml order by year desc group by title papers: from papers.yaml order by year desc where (not (type = 'review')) reviews: from papers.yaml order by year desc where type = 'review' talks: from talks.yaml where date < '2009-09-01' order by date desc group by title dissertations: from dissertations.yaml order by role then year group by role theses: from theses.yaml order by year then student courses: from courses.yaml order by number group by title data: <<: *cvdata html: yes
- url: cv.tex title: CV inmenu: no template: cv.st layout: layout.tex.st data: <<: *cvdata html: yes
- url: papers.html title: Papers template: papers.st data: papersbyyear: from papers.yaml order by year desc then title group by year
yst's query language is limited, and there are lots of things you can do with a full-fledged database that you can't do with yst. But yst is ideal, I think, for small to medium data-driven sites that are maintained by a single person who likes working with plain text. It scratched my itch, anyway, and I release it in case anyone else has the same itch.
Code, documentation, and bug reports: http://github.com/jgm/yst/tree/master
John
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- jinjing

Thanks. I'll put a note to this effect in the README. John +++ Jinjing Wang [Aug 03 09 18:17 ]:
It's possible to serve the generated site with maid, in case apache is not available:
cabal update cabal install maid
yst create testsite cd testsite yst
cd site maid
now goto http://localhost:3000/
On Mon, Aug 3, 2009 at 9:05 AM, John MacFarlane
wrote: I'm pleased to announce the release of yst, now available on HackageDB. yst generates static websites from YAML or CSV data files and StringTemplates. This approach combines the speed, security, and ease of deployment of a static website with the flexibility and maintainability of a dynamic site that separates presentation and data.
The easiest way to get a feel for yst is to try it:
cabal update cabal install yst yst create testsite cd testsite yst
yst attempts to fill a niche between two kinds of site creation tools. On the one hand you have simple static site generators like webgen, webby, nanoc, and my old custom system using make and pandoc. On the other hand, you have dynamic web frameworks like rails and django. For my own smallish websites, I found that the dynamic frameworks were overkill. Nobody but me was going to edit the pages, and I didn't want the trouble of writing and deploying a dynamic site, setting up a web server, and administering a database. A static site would be faster, easier to deploy, and more secure. But the dynamic frameworks offered one thing that the static site generators did not: an easy way to separate data from presentation. This was becoming increasingly important to me as I found myself constantly updating the same information (say, publication data for a paper) in multiple places (say, a LaTeX CV and a differently formatted web listing of papers).
What I wanted was a site generation tool that used YAML text files as a database and allowed different kinds of documents to be produced from the same data. I couldn't find anything that did just what I wanted, so I wrote yst. By way of illustration, here are the build instructions for HTML and LaTeX versions of a CV, plus a web page with a list of papers:
- url: cv.html title: CV template: cv.st data_common: &cvdata contact: from contact.yaml jobsbyemployer: from jobs.yaml order by start group by employer degrees: from degrees.yaml order by year desc awards: from awards.yaml order by year desc group by title papers: from papers.yaml order by year desc where (not (type = 'review')) reviews: from papers.yaml order by year desc where type = 'review' talks: from talks.yaml where date < '2009-09-01' order by date desc group by title dissertations: from dissertations.yaml order by role then year group by role theses: from theses.yaml order by year then student courses: from courses.yaml order by number group by title data: <<: *cvdata html: yes
- url: cv.tex title: CV inmenu: no template: cv.st layout: layout.tex.st data: <<: *cvdata html: yes
- url: papers.html title: Papers template: papers.st data: papersbyyear: from papers.yaml order by year desc then title group by year
yst's query language is limited, and there are lots of things you can do with a full-fledged database that you can't do with yst. But yst is ideal, I think, for small to medium data-driven sites that are maintained by a single person who likes working with plain text. It scratched my itch, anyway, and I release it in case anyone else has the same itch.
Code, documentation, and bug reports: http://github.com/jgm/yst/tree/master
John
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- jinjing _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hey John,
I noticed that your code is using the Syck library for Yaml. How were you
able to get it to deal with Unicode characters? I just wrote a new yaml
library based on libyaml if you want to give it a shot (yaml on hackage). It
doesn't support aliases, but is otherwise feature complete.
Michael
On Mon, Aug 3, 2009 at 7:12 PM, John MacFarlane
Thanks. I'll put a note to this effect in the README.
John
+++ Jinjing Wang [Aug 03 09 18:17 ]:
It's possible to serve the generated site with maid, in case apache is not available:
cabal update cabal install maid
yst create testsite cd testsite yst
cd site maid
now goto http://localhost:3000/
On Mon, Aug 3, 2009 at 9:05 AM, John MacFarlane
wrote: I'm pleased to announce the release of yst, now available on HackageDB. yst generates static websites from YAML or CSV data files and StringTemplates. This approach combines the speed, security, and ease of deployment of a static website with the flexibility and maintainability of a dynamic site that separates presentation and data.
The easiest way to get a feel for yst is to try it:
cabal update cabal install yst yst create testsite cd testsite yst
yst attempts to fill a niche between two kinds of site creation tools. On the one hand you have simple static site generators like webgen, webby, nanoc, and my old custom system using make and pandoc. On the other hand, you have dynamic web frameworks like rails and django. For my own smallish websites, I found that the dynamic frameworks were overkill. Nobody but me was going to edit the pages, and I didn't want the trouble of writing and deploying a dynamic site, setting up a web server, and administering a database. A static site would be faster, easier to deploy, and more secure. But the dynamic frameworks offered one thing that the static site generators did not: an easy way to separate data from presentation. This was becoming increasingly important to me as I found myself constantly updating the same information (say, publication data for a paper) in multiple places (say, a LaTeX CV and a differently formatted web listing of papers).
What I wanted was a site generation tool that used YAML text files as a database and allowed different kinds of documents to be produced from the same data. I couldn't find anything that did just what I wanted, so I wrote yst. By way of illustration, here are the build instructions for HTML and LaTeX versions of a CV, plus a web page with a list of papers:
- url: cv.html title: CV template: cv.st data_common: &cvdata contact: from contact.yaml jobsbyemployer: from jobs.yaml order by start group by employer degrees: from degrees.yaml order by year desc awards: from awards.yaml order by year desc group by title papers: from papers.yaml order by year desc where (not (type = 'review')) reviews: from papers.yaml order by year desc where type = 'review' talks: from talks.yaml where date < '2009-09-01' order by date desc group by title dissertations: from dissertations.yaml order by role then year group by role theses: from theses.yaml order by year then student courses: from courses.yaml order by number group by title data: <<: *cvdata html: yes
- url: cv.tex title: CV inmenu: no template: cv.st layout: layout.tex.st data: <<: *cvdata html: yes
- url: papers.html title: Papers template: papers.st data: papersbyyear: from papers.yaml order by year desc then title group by year
yst's query language is limited, and there are lots of things you can do with a full-fledged database that you can't do with yst. But yst is ideal, I think, for small to medium data-driven sites that are maintained by a single person who likes working with plain text. It scratched my itch, anyway, and I release it in case anyone else has the same itch.
Code, documentation, and bug reports: http://github.com/jgm/yst/tree/master
John
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- jinjing _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

+++ Michael Snoyman [Aug 03 09 22:20 ]:
Hey John,
I noticed that your code is using the Syck library for Yaml. How were you able to get it to deal with Unicode characters? I just wrote a new yaml library based on libyaml if you want to give it a shot (yaml on hackage). It doesn't support aliases, but is otherwise feature complete.
Michael
Oh, rats, I hadn't realized that Syck had that limitation! I think I can work around it, but I'll have to look into it. I wasn't able to install your yaml library: % cabal install yaml Resolving dependencies... Configuring yaml-0.0.0... Preprocessing library yaml-0.0.0... dist/build/Text/Libyaml.chs.h:2:31: error: ../../../c/helper.h: No such file or directory c2hs: Error during preprocessing custom header file cabal: Error: some packages failed to install: yaml-0.0.0 failed during the building phase. The exception was: exit: ExitFailure 1 I have debian libyaml-dev installed. Any ideas? Also, how hard would it be to support aliases in your package? I use them. John

+++ John MacFarlane [Aug 03 09 13:23 ]:
+++ Michael Snoyman [Aug 03 09 22:20 ]:
Hey John,
I noticed that your code is using the Syck library for Yaml. How were you able to get it to deal with Unicode characters? I just wrote a new yaml library based on libyaml if you want to give it a shot (yaml on hackage). It doesn't support aliases, but is otherwise feature complete.
Michael
Oh, rats, I hadn't realized that Syck had that limitation! I think I can work around it, but I'll have to look into it.
Okay, I've found a workaround -- use Syck to parse a bytestring, then do my own decoding on string buffers in the resulting parse tree. Unicode in data files now works well. (Code now on github -- will be released soon.) John

Excerpts from John MacFarlane's message of Mon Aug 03 03:05:00 +0200 2009:
I'm pleased to announce the release of yst, now available on HackageDB.
Great! I've used it for a web site of mine today with success. -- Nicolas Pouillard http://nicolaspouillard.fr
participants (5)
-
Jinjing Wang
-
John MacFarlane
-
Michael Snoyman
-
Nicolas Pouillard
-
Robert Wills