◊(Local Yarn Code "template-html.rkt at [28ee8201]")

File template-html.rkt artifact 45af1f57 part of check-in 28ee8201


#lang pollen/mode racket/base

;; Copyright (c) 2018 Joel Dueck.
;;
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; A copy of the License is included with this source code, in the
;; file "LICENSE.txt".
;; You may also obtain a copy of the License at
;;
;;       http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
;;
;; Author contact information:
;;   joel@jdueck.net
;;   https://joeldueck.com
;; -------------------------------------------------------------------------

;; Provides functions for displaying content in HTML templates.
(require pollen/core
         "dates.rkt")

(provide (all-defined-out))

(define (ht-head [title #f])
  ◊@{<head>
     <title>The Local Yarn◊when/splice[title]{: ◊title}</title>
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <link rel="stylesheet" type="text/css" href="/web-extra/martin.css">
     </head>})

(define (ht-page-top)
  ◊@{<body><main>
     <a href="/"><header>
     <img src="/web-extra/logo.png" height="103" width="129" class="logo">
     <h1>The Local Yarn</h1>
     </header></a>})

(define (ht-article-header)
  (define title (select-from-metas 'title (current-metas)))
  (define published (select-from-metas 'published (current-metas)))
    (cond
      [title
       ◊@{<article class="with-title hentry">
          <h1 class="entry-title">◊|title|</h1>
          <p class="time"><a href="#" class="rel-bookmark">
          <time datetime="◊published" class="published">◊ymd->english[published]</time>
          </a></p>
          <section class="entry-content">}]
      [else
       ◊@{<article class="no-title hentry">
          <h1><a href="#" class="rel-bookmark">
          <time datetime="◊published" class="entry-title">◊ymd->english[published]</time>
          </a></h1>
          <section class="entry-content">}]))

(define (ht-article-footer)
  ◊@{</section>
     <footer class="article-info"><span class="x">(</span>Part of ‘Talking About Poetry’. Once I threw a mudball at a birdhouse. I’m not exactly proud of it, though.<span class="x">)</span></footer>
     </article>})
  
(define (ht-page-bottom)
  ◊@{<footer>By Joel Dueck</footer>
     </main></body>})