~joram/joram.io

df5e89a9bdb4323343beadd9c7633e487ea7a1f3 — Joram Schrijver 3 years ago e57effc
Add some meta descriptions
4 files changed, 32 insertions(+), 11 deletions(-)

M blog/android-streaming-mpd/post.md
M generate.lisp
M index.md
M templates/default.ctml
M blog/android-streaming-mpd/post.md => blog/android-streaming-mpd/post.md +3 -0
@@ 1,5 1,8 @@
---
title: Streaming music on Android using MPD
description:
  How I stream my own music library to Android using MPD,
  while avoiding too much bandwidth usage for lossless audio.
published: 2020-05-18
---


M generate.lisp => generate.lisp +25 -11
@@ 47,6 47,7 @@

(defstruct post
  title
  description
  published
  updated
  url


@@ 54,19 55,24 @@

;;; Templates -----------------------------------------------------------------

(defun default-template (title body)
(defun default-template (title description body)
  (clip:process #p"templates/default.ctml"
                :title title
                :description description
                :body body))

(defun page-template (title browser-title body)
  (default-template browser-title (clip:process #p"templates/page.ctml"
                                                :title title
                                                :body body)))
(defun page-template (title browser-title description body)
  (default-template browser-title
                    description
                    (clip:process #p"templates/page.ctml"
                                  :title title
                                  :body body)))

(defun post-template (post)
  (default-template (post-title post) (clip:process #p"templates/post.ctml"
                                                    :post post)))
  (default-template (post-title post)
                    (post-description post)
                    (clip:process #p"templates/post.ctml"
                                  :post post)))

;;; ATOM feed -----------------------------------------------------------------



@@ 117,10 123,14 @@
  (let* ((metadata (pandoc-metadata in))
         (title (st-json:getjso "title" metadata))
         (browser-title (or (st-json:getjso "browserTitle" metadata)
                            title)))
                            title))
         (description (st-json:getjso "description" metadata)))
    (check-type title string)
    (check-type browser-title string)
    (plump-content out (page-template title browser-title (pandoc-markup in)))))
    (check-type description string)
    (plump-content out (page-template title browser-title
                                      description
                                      (pandoc-markup in)))))

(defun relative-path (absolute-pathname base)
  (let ((pathname-directory (pathname-directory absolute-pathname))


@@ 154,12 164,14 @@
         (html (pandoc-markup post.md))
         (metadata (pandoc-metadata post.md))
         (title (st-json:getjso "title" metadata))
         (description (st-json:getjso "description" metadata))
         (published-string (st-json:getjso "published" metadata))
         (published (when published-string (parse-timestring published-string)))
         (updated-string (st-json:getjso "updated" metadata))
         (updated (when updated-string (parse-timestring updated-string)))
         (post (make-post
                :title title
                :description description
                :published published
                :updated updated
                :url (format nil "/~a" path)


@@ 179,8 191,10 @@

(plump-content
 "blog/index.html"
 (page-template "Blog" "Blog" (clip:process #p"templates/post-list.ctml"
                                            :posts *posts*)))
 (page-template "Blog" "Blog"
                "Sporadic blog posts about things that might be interesting."
                (clip:process #p"templates/post-list.ctml"
                              :posts *posts*)))

(page "index.html" "index.md")


M index.md => index.md +1 -0
@@ 1,6 1,7 @@
---
title: Hi, I'm Joram.
browserTitle: Joram Schrijver
description: The homepage of Joram Schrijver.
---

I program, among other things. Some of my code is

M templates/default.ctml => templates/default.ctml +3 -0
@@ 3,6 3,9 @@
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="viewport" content="initial-scale=1">
  <title><c:splice lquery="(text title)">TITLE</c:splice> - Joram Schrijver</title>
  <c:if test="description">
    <c:then><meta name="description" lquery="(attr :content description)"></c:then>
  </c:if>
  <link rel="stylesheet" type="text/css" href="/style.css" />
  <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Reinventing the Future" />