The enlive deftemplate macro expects a series of tag / content pairs after the args vector (the args [id] vector in your example). You cannot just paste let there because the macro does not expect a let form, so when it performs its splicing, everything gets corrupted and leads to the behavior described above.
One way to fix this is to write your own deftemplate macro, which allows you to bind definitions using identifiers in the args vector. Example:
(alt/deftemplate project-main-page (en/xml-resource "project-main.html") [id] [project (get-project id)] [:#project-name] (en/content (str "Name: " (project :name))) [:#project-desc] (en/content (str "Desc: " (project :desc))))
The deftemplate macro is a simple wrapper around the template that uses snippet* , and this is probably where you need to insert your changes:
(defmacro snippet* [nodes args & forms] `(let [nodes
Another option, which might be simpler since you do not need to guess in the library code, would be to add a level of indirection to your get-project function to cache the results. You can try the core.cache library.
source share