Recently Written · git

coleslaw

Emacs mode for the "Coleslaw" site generator written in Common Lisp.

git clone https://github.com/equwal/coleslaw

Log | Files | Refs


plugins/twitter-summary-card.lisp (834 bytes)

1 (defpackage :coleslaw-twitter-summary-card
2   (:use :cl :coleslaw)
3   (:export #:enable))
4 
5 (in-package :coleslaw-twitter-summary-card)
6 
7 (defun summary-card (post twitter-handle)
8   "TODO: Figure if and how to include twitter:url meta property."
9   (format nil "<meta property=\"twitter:card\" content=\"summary\" />
10 ~@[<meta property=\"twitter:author\" content=\"~A\" />~]
11 <meta property=\"twitter:title\" content=\"~A\" />
12 <meta property=\"twitter:description\" content=\"~A\" />"
13           twitter-handle
14           (title-of post)
15           (let ((text (content-text post)))
16             (if (< 200 (length text))
17                 (subseq text 0 199)
18                 text))))
19 
20 (defun enable (&key twitter-handle)
21   (add-injection
22    (lambda (x)
23      (when (typep x 'post)
24        (summary-card x twitter-handle)))
25                  :head))