Skip to content

Instantly share code, notes, and snippets.

@AlexBaranosky
Created September 12, 2014 04:21
Show Gist options
  • Save AlexBaranosky/9dff767ad2ab2d56d99f to your computer and use it in GitHub Desktop.
Save AlexBaranosky/9dff767ad2ab2d56d99f to your computer and use it in GitHub Desktop.
(require '[stencil.core :as s])
(def nav-links [{:url "a.html"
:text "Resume"}
{:url "b.html"
:text "Blog"}
{:url "c.html"
:text "About"}])
(defn nav [links]
(s/render-string
"<div id='nav'>
<ul>
{{#links}}
<li><a href=\"{{{url}}}\">{{{text}}}</a></li>
{{/links}}
</ul>
</div>"
{:links links}))
(defn page [content]
(s/render-string
"<header></header>
<body>
{{{nav}}}
{{{content}}}
</body>
<footer></footer>"
{:content content
:nav (nav nav-links)}))
(defn homepage []
(page "Welcome to my website!"))
(print (homepage))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment