Book Image

Clojure Web Development Essentials

By : Ryan Baldwin
Book Image

Clojure Web Development Essentials

By: Ryan Baldwin

Overview of this book

Table of Contents (19 chapters)
Clojure Web Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Rendering the results


We'll be using Selmer to render the Recently Added albums. We'll then display the rendered results instead of the crazy raw JSON.

Selmer templates, to refresh your memory, are stored in the resources/templates directory. As you may have guessed by now, I appreciate a nicely organized tree structure. So instead of throwing the recently-added template in with the rest of our templates, we'll create a new albums directory and house our album-related templates there:

  1. Create a new directory, albums, in resources/templates.

  2. Create a new Selmer template for our recently added albums, resource/templates/albums/recently-added.html, with the following content:

    {% extends "templates/base.html" %}       <!-- 1 -->
    {% block content %}                       <!-- 2 -->
    <h1>Recently Added</h1>
    <ol class="albums">
        {% for a in albums %}                 <!-- 3 -->
        <li>
            <div class="artist"><a href="/albums/{{a.artist}}"&gt...