![]() Slurp-content in this function extracts the file contents and converts it to a map based on the YAML frontmatter and the content bodyĪt the end each bit of content (article, screencast, talk entry etc.) is a map that can be passed around to generate category pages, RSS feeds, HTML pages. The heart of my content processing is a simple little function ( defn entries ( let ( -> entries ( filter :published ) ( map # ( assoc % :uri ( case ( keyword ( :type % )) :article ( article-uri % ) :screencast ( screencast-uri % ) :talk ( :url % ) :project ( :url % )))) ( sort-by :date ) ( reverse )))) In my site I slurp a directory of metadata enriched markdown files (YAML frontmatter) and thread them through a bunch of transformation functions. This is an excellent starting point for transforming file based content. To complement this stasis also gives you a method to slurp a directory, read its contents and generate one of these content maps. Running that would result in and index.html file in the /build folder of your project with the contents above. You could serve an simple hello world style site like this. An export-pages function for saving content to diskīoth of these expect a map of path and content and thats it.Fundamentally speaking Stasis gives you two entry points Thats directly from the Stasis README and as you can guess it's spot on. Statis just offers a few functions that are useful when creating static web sites. The next few sections are observations I've made during the migration. Once I started the work in Clojure it was clear I was able to better express my intent. I had started with refactoring the existing Ruby codebase but the content tidy up effort was proving awkward in Ruby. I was knee deep in using Clojure and decided the project was substantial enough to help further my education. ![]() So why move from Ruby to Clojure, Middleman to Stasis? Truth be told it was initially a learning experience. many of the older posts use embedded gists and I wasn't happy with that. ![]()
0 Comments
Leave a Reply. |